Geometry Form1 Picture3 LinkOpt Linkage CubeOpt Rotating Cube GeoPic Picture1 VScroll1 VScroll2 Picture2 RunButton StopButton ExitButton Form_Clickq CircInterSect Sigma1+ Sigma2 PartA PartB Sigma PartC. Command1_Click" Command2_Click GeoPic Command3_Click ExitButton_Click ClearButton_Click TestButton_Click drawwidthK sfAngle1 dfLinkLen dfLever2LenU dfLever2X dfLever2Y DrawMech LeverEndX LeverEndY7 MechPic VScroll1U valueA @ Form_Load RunButton_Click VScroll1_Change$ iAnglec RunButton enabled StopButtonL TestButton StopButton_Click VScroll2_Change dfLever2 VScroll2 VScroll1_GotFocus ExitButton VScroll2_GotFocusd Form_Paint- BorderBoxRaised Picture1C Picture2 Picture3 CubeOpt_Click CubeOpts scalewidth scaleheight scaletopb scaleleft LinkOpt_Click LinkOpt7 smallchange largechange DrawAxis Alpha iEraseB sfAlpha sfBeta singe> dfCubeVertX dfCubeVertY dfCubeVertZ: GeoPic_Click drawstyle DrawCube CubeVertX CubeVertY RotateCubeI forecolor Rotate Theta Theta1 RotatePoint SolidRotate. dfAlpha dfBetae dfCubeVertX0u dfCubeVertY0 dfCubeVertZ0 dfCubeVertX1 dfCubeVertY1 dfCubeVertZ1X NewCube dfCubeVert0g CenterOfRotation dfCubeVert16 Printed RunCubeRotation visible WipeNewCubet enable CircInter SolidRotate2 Source1 Source2 Bleft BWide width BHigh height objects^ Geometry and animation from... Ivory Tower Software Richard Wagner, vice president, development CIS 76427,2611 Input lever angle, single floating Length of the link from the input lever to the output lever' Length of the output lever, double floating X coordinate of the output lever center of rotationi Y coordinate of the output lever center of rotationi Spherical coordinate of axis of cube rotation (about Z from +X)V Spherical coordinate of axis of cube rotation (from X-Y plane) Array of cube vertices' X coordinates (start)u Array of cube vertices' Y coordinates (start)u Array of cube vertices' Z coordinates (start)u Array of cube vertices' X coordinates (end)t Array of cube vertices' Y coordinates (end)t Array of cube vertices' Z coordinates (end)c ExitButton_Click DrawMech Radius is 10 in a scalewidth of 100o Double precision is used because CircInterSect needs its Erases previous line Convert input angle to radians Call the GEO dll subroutine to find the intersection of the two circles: Form_Load double floating cube vertex X starting VScroll1_Change RunButton_Click 2 degree incrementse StopButton_Click VScroll2_Change VScroll1_GotFocus VScroll2_GotFocus Form_Paint CubeOpt_Click LinkOpt_Click DrawAxis Point p defines the axis of rotation which in this application passes through the origin Erase the existing lineh Draw the new line DrawCube The cube to draw exists in 3-space. This drawing is a simple flat projection onto the X-Y plane so it will show no perspective (no sense of "depth"). See the demo application CSC.MAK for an example of true perspective renderingi of 3d objects. Just to keep track of vertices, this routine tacks on a number for each corner.e To erase, draw over previous with background color, using "Cls" makes a jumpy picture. Erase the cube Redraw the cube RotateCube For each vertex, call SolidRotate to find its new point in 3-space for the angle it rotates through: These are "home" coordinates which never changes These are the new coordinates to draw the rotated cube NewCube Draw a virgin cube RunCubeRotation A rotation axis pointt 5 degree incrementsg Theta must be between -pi and pi Erase previous cube drawingc Put the axis back if neededa The other rotation axis points 90 makes a nice long lineo Draw the new cubeh Be friendlyc WipeNewCube Erase a virgin cube BorderBoxRaised This sub simulates a raised surface on the form by drawing lines.e