A sphere of radius R, centered at the (0,0,0): coefficients=(1,0,0,0, 1,0,0, 1,0, -r^2).
A cylinder of infinite extent with radius R, centered at (0,0,0) coefficients=(1,0,0,0, 1,0,0, 0,0, -r^2).
A cone of infinite extent with apex at (0,0,0) and radius r at a distance of d from the apex: coefficients=(1,0,0,0, 1,0,0, -r/d, 0, 0).
A plane with normal nx,ny,nz passing through (0,0,0): coefficients=(0,0,0,nx, 0,0,ny, 0,nz, 0).
A special texture map exits for use with this object in: textures/cut.texture.map.
scale_factor is a scale factor used to scale the distances from the planes. The resulting texture coordinates may be outside the 0 to 1 interval. If so, the texture will repeat unless repeat_off! is sent to the texture instance being used by the actor.
algebraic_distance_on/off! sets the distance metric for the quadrics. Normally, the algebraic distance, f(x,y,z), is used to calculate distance. If algebraic_distance_off! , the euclidean distance is calculated. This is about four times slower that the algebraic distance and is usually only needed if accurate outlining of cut boundaries is required.
<boolean.scr
/* We use spheres as models, but any model will do */ sphere_modeller new: aSphereModel resolution=5 ; /* Define an elliptical cylinder */ texture_map_cut_quadric new: qcyl data_in=aSphereModel s_coefficients=(1,0,0,0, 2,0,0, 0,0, -.202) t_coefficients=(3,0,0,0, 1,0,0, 0,0, -.16) scale_factor=5 ; /* Need a display all for rendering */ display_all new: aDa data_in= qcyl ; /* This is a special cutting texture.
NOTE: no interpolation is specified. This is important!! */
/* Two spheres, yellow one inside a white one */ property new: bprop color=(1,0,0); property new: bprop2 color=(1,0,1); actor new: anactor modeller=aDa texture=case_7 backface_property=bprop ; actor new: another modeller=aDa texture=case_7 scale=(.9,.9,.9) color=(1,1,0) backface_property=bprop2 ; /* A third sphere that we'll follow with our quadric cutter. It's blue */ actor new: cutter modeller=aSphereModel scale=(.447,.447,.447) color=(0,1,1) ; /* a camera to watch the magic unfold */ camera new: c1 position=(0,0,1) focal_point=(0,0,0) range=(-1,1,-1,1,-1,1) default! on! ; /* A renderer. For now, only the SGI supports texture */ renderer new: aren actors=(cutter,another,anactor) cameras=c1 ; /* We need a person to watch the small sphere. We'll use this helper's transformation to transform the quadric, keeping an "eye" on the small sphere */ person new: helper; /* We keep a vector from the camera to the small sphere */ vector new: `along' dimension=3; /* Now a loop to have the small sphere move through the two bigger ones
under the watchful eye of the helper, who in turn provides a
a transformation for the quadric */ cue new: follow resolution=1 start_actions=" cutter position=(-2,0,0); " tick_actions=" cutter position+ (.1,0,0); along = [cutter position?] - [c1 position?]; helper position=[c1 position?] up=[c1 view_up?] front=along; qcyl matrix=[helper composite_matrix?];
aren render!; " duration=15 ; ! send follow start! to see the action
cue new: twist resolution=1 start=15 duration=30 tick_actions=`qcyl rotate_z:12;' ;
cue new: spin resolution=1 start=30 duration=60 tick_actions=`c1 azimuth:12;' ;
scene new: ascene resolution=1 cues=(follow,spin,twist) renderers=aren;