JanetTerra
Jul 22, 2006
==Chapter 1: Documentation of Liberty BASIC Wire Frame Functions== ===Tom Nally=== Return to [[LBWFCh01|Introducing the Liberty BASIC Wire Frame Library]] ---------- ==Contents== ===Set Up the Viewing Environment=== [[LBWireFrameDoc01#Function01|Function FF.LBWF.Camera(CamX, CamY, CamZ, VCtrX, VCtrY, VCtrZ, ZoomFac)]] [[LBWireFrameDoc01#Function02|Function FF.LBWF.Camera(CamX, CamY, CamZ, VCtrX, VCtrY, VCtrZ, ZoomFac)]] ===Creating Boxes and Cylinders=== [[LBWireFrameDoc01#Function03|Function FF.LBWF.CreateBox(BoxName$, xdim, zdim, boxheight, BoxColor$)]] [[LBWireFrameDoc01#Function04|Function FF.LBWF.CreateCylinder(CylName$, radius, numSides, cylheight, CylColor$)]] ===Moving an Object=== [[LBWireFrameDoc01#Function05|Function FF.LBWF.TranslateObject(ObjectName$, transX, transY, transZ)]] [[LBWireFrameDoc01#Function00|Function ()]] ---------- ===Set Up the Viewing Environment=== [[#Function01]] **Function FF.LBWF.Camera(CamX, CamY, CamZ, VCtrX, VCtrY, VCtrZ, ZoomFac)** In order to create a wire model view, the programmer must establish the point in space where the camera resides, and then identify the point in space where the camera points. > CamX, CamY, CamZ - The x-, y- and z-coordinates of the camera location. > VCtrX, VCtrY, VCtrZ - The x-, y- and z-coordinates of the point in space where the camera is pointed. > ZoomFac - The zoom factor. Start out by assigning ZoomFac = 1. If the image is too large or too small, adjust accordingly. [[#Function02]] **Function FF.LBWF.ScreenCenter(ScrCenterX, ScrCenterY)** This function establishes the "screen center". Essentially, the screen center is the point in your Liberty BASIC graphicbox that corresponds to the point defined by (VCtrX, VCtrY, VCtrZ). > ScrCenterX - Usually, this is the x-coordinate of the center of the graphicbox > ScrCenterY - Usually, this is the y-coordinate of the center of the graphicbox Occasionally, the programmer does not want to plot the 3D image at the center of the graphicbox. In that case, move ScrCenterX and ScrCenterY accordingly. ---------- ===Creating Boxes and Cylinders=== Version 0.5 of the //LBWF Library// provides functions for the creation of six different objects. Below, I will provide the documentation for creating boxes and cylinders. In subsequent chapters, I will provide documentation for additional objects. [[#Function03]] **Function FF.LBWF.CreateBox(BoxName$, xdim, zdim, boxheight, BoxColor$)** As the reader could guess, this function creates a //box//. Understand, however, that the data for the box is merely created in memory. The box will not be plotted in the graphicbox until a function is called which draws the object. > BoxName$ - All LBWF objects must be assigned names. Names are handled as strings. The Library recommends that the programmer use object names without spaces. > xdim - The dimension of the box in the x-direction > zdim - The dimension of the box in the Z-direction > boxheight - The height of the box. > BoxColor$ - All objects must be given a color, passed to the function as a string. See the Liberty BASIC help files for proper ways to designate colors. So, where are boxes -- and other objects -- plotted? The default location of a box is centered on the y-axis, with the bottom of the box resting on the X-Z plane. All objects are originally positioned similarly. Elsewhere, I will identify the function that allows the programmer to move any objects she creates. [[#Function04]] **Function FF.LBWF.CreateCylinder(CylName$, radius, numSides, cylheight, CylColor$)** > CylName$ - The name of the cylinder, sent to the function as a string. > radius - The radius of the cylinder > numSides - The number of sides that you want the cylinder to have. Not that in the example above, the cylinder has 20 sides. > cylheight - The height of the cylinder. > CylColor$ - The color of the cylinder, sent to the function as a string. ---------- ===Moving an Object=== [[#Function05]] **Function FF.LBWF.TranslateObject(ObjectName$, transX, transY, transZ)** To //translate// an object means to move the object without rotating it. LBWF provides a single translation function to move an object in any or all of the x-, y-, or z- axes. > ObjectName$ - The name of the object to be translated. This must be the name used when the object was created. > transX, transY, transZ - The number of units to move the object in the x-, y- and z- directions. Note that this function will always move the object relative to the object's current position. Note also that the object will not //appear// to move until a subsequent draw command is issued. ----------