Date: February 12, 2009
Due: February 26, 2009

Arch 544: Parametric Rapid Prototyping
Assignment 4: Procedures That Express Recurring Relations

The procedures referred to in these problems express recurring relations as loops. The first three problems have you modify an exiting procedure. The last extra credit problem requires that you construct such a procedure from scratch.


Problem 1

As we had illustrated in Chapter 3, the following GC script can be used to draw a circle as a series of line segments along its circumference. Note that it contains a variable degrinc that controls the resolution of the circle (the number many incremental degrees between each point on the line segments that form the circle). Note too that there is a variable degr which is used in the relational operator statement degr <= 360.0 and which controls the the revolution of the point in determining the circle.

function(){

// Procedure makecircle to draw a circle as a series of line segments

Point originPoint = new Point();
Point circlePoints= {}; //create empty list of points
Polygon circlePoly = new Polygon (this);
double degr, degrinc;
double radius, radians;
double distx, disty;
double xval, yval, zval;
int index;


// initialize values
xval = 0.0;
yval = 0.0;
zval = 0.0;
originPoint.ByCartesianCoordinates(baseCS, xval, yval, zval);
 
radius = 4;
degr = 0;
degrinc = 20;
index = 0;

// Initiate Drawing of Circle while number of degrees less than or equal to 360

while (degr <= 360.0)
{

// Determine x value and y value of Point
    distx = Cos(degr) * radius;
    disty = Sin(degr) * radius;
    Print("distx = " + distx + "\n");
    Print("disty = " + disty + "\n");

// determine a point for the current value of distx and disty.
    xval = originPoint.X + distx;
    yval = originPoint.Y + disty;
    zval = originPoint.Z;

    Point curPoint = new Point();
    curPoint.ByCartesianCoordinates(baseCS, xval, yval, zval);
    circlePoints[index] = curPoint;
    index = index + 1;

// Increment the number of degrees of revolution of the point
    degr = degr + degrinc;
 
}

circlePoly.ByVertices(circlePoints);

}

 

part a: how would you modify the procedure above such that it draws a decagon -a ten sided polygon (hint: modify degrinc). Save your modified procedure under the name makedecagon.gct and place it your submit directory.
part b: how would you modify the procedure above such that it draws an octagon (hint modify degrinc). Save your modified procedure under the name octa.gct and place it in your submit directory.
part c: how would you modify the procedure above such that it draws a semi-circle (hint: modify the relational operator statement) .Save your modified procedure under the name semicir.gct and place it in youryour submit directory.

Problem 2

Lets return to the log spiral from chapter 3. Recall that the procedure draws a logarithmic spiral from a series of curves. Note that it contains a variable constanta that determines the accelaration rate of the spiral.The value of constanta below is set for the size of a particular nautilus shell.

function(){

// Procedure to make a logarithmic spiral

Point originPoint = new Point();
Point spiralPoints= {}; //create empty list of points
PolyLine archimedessprialPoly = new PolyLine (this);
double degr, degrinc;
double radius, radians;
double distx, disty;
double xval, yval, zval;
double numrev;
int index;
double constanta, constante;

// initialize values
xval = 0.0;
yval = 0.0;
zval = 0.0;
originPoint.ByCartesianCoordinates(baseCS, xval, yval, zval);
 
radius = 4;
degr = 0;
degrinc = 10;
index = 0;
numrev = 5.0;

constanta = 344; //value that works for a Nautilus shell.
constante = 2.7182818;


// Initiate Drawing of Circle while number of degrees less than 360

do
{
// calculate radius on the basis of logarithmic progression

// note that degrees = log(radius) * constanta,
// which means that degrees/constanta = log(radius),
// which in turn yields:

    radius = Pow (constante, (degr / constanta));
   
// Determine x value and y value of Point
    distx = Cos(degr) * radius;
    disty = Sin(degr) * radius;

// determine a point for the current value of distx and disty.
    xval = originPoint.X + distx;
    yval = originPoint.Y + disty;
    zval = originPoint.Z;
    Point curPoint = new Point();
    curPoint.ByCartesianCoordinates(baseCS, xval, yval, zval);
    spiralPoints[index] = curPoint;
    index = index + 1;
   
// Increment the number of degrees of revolution of the point
    degr = degr + degrinc;
}
while (degr <= (360.0 * numrev));


// Draw circle from Polygon segments
archimedessprialPoly.ByVertices(spiralPoints);
}

part a: Recreate and edit this program such that the spiral accelerates more rapidly outward. That is, recreate it such that the spiral reaches a larger scale more quickly upon each revolution of point (P) about the origin. Save your modified procedure under the name logbigr.gct and place it in your submit directory.

 

+
Animation of thee logarithmic spirals (orange, yellow and green) for correspondingly 3 different values of the variable constanta expanding at 360 degrees or 1 revolution per frame. For any given number of revolutions, the size drawing area covered by each frame is increased to accommodate the size of the increasingly largest spiral (green). It appears that the spirals are shrinking in size, but actually they are expanding while simultanteously the frame takes in an inceasing area of the drawing.

part b: Within the present version of the procedure, the while loop is continued as long as the number of degr degrees of revolution is less than numrev * 360.0, or 5 * 360.0 =1800 degrees. Alternatively, we might have the while loop continue as long as the radius of the point (P) of this program remains within a certain limit. That is, you might recreate the procedure such that you use the radius variable in conjunction with the relational operator at the beginning of the loop. Redevelop the procedure so that radius controls the loop. You may note that a large radius is needed to accommodate many revolutions. You will also note that we quickly run out of drawing limits as soon as we reach roughly 10 revolutions for constanta = 344. Save your modified procedure under the name lograd.gct and and place it in your submit directory.


Problem 3

Write a GC Script  drwnsqr.gct that draws a square from four predefined points and then draws a succession of inner rotated squares. Each inner rotated square is formed at the mid-points of each side of the preceding outer square.

+

 

Animation of the procedure

You can initiate the development of this program by creating a prototype of a simpler version. The prototype might first be a script that draws a square and then a mid-point of a square. From this procedure, you may then begin to use a loop to make this into an iterative process.

function(){
//This procedure draws a square and then a second square from the midpoints within a square

//Initialize the points and variables needed for the outer square & midpoints
Point ptSW = new Point();
Point ptSE = new Point();
Point ptNE = new Point();
Point ptNW = new Point();
Point ptM1 = new Point();
Point ptM2 = new Point();
Point ptM3 = new Point();
Point ptM4 = new Point();
Point ptOrigin = new Point();
double lengthside;

double xval, yval, zval;

xval = 0;
yval = 0;
zval = 0;
lengthside = 10;
ptOrigin.ByCartesianCoordinates(baseCS, xval, yval, zval);

//STEP 1: Draw the outer square
ptSW.ByCartesianCoordinates(baseCS, xval, yval, zval);

xval = xval + lengthside;
ptSE.ByCartesianCoordinates(baseCS, xval, yval, zval);

yval = yval + lengthside;
ptNE.ByCartesianCoordinates(baseCS, xval, yval, zval);

xval = ptOrigin.X;
ptNW.ByCartesianCoordinates(baseCS, xval, yval, zval);

Polygon squareouter = new Polygon(this);
squareouter.ByVertices({ptSW, ptSE, ptNE, ptNW, ptSW});

//STEP 2: Get the midpoints of the outer square
xval = (ptSW.X + ptSE.X) / 2.0;
yval = (ptSW.Y + ptSE.Y) / 2.0;
zval = (ptSW.Z + ptSE.Z) / 2.0;
ptM1.ByCartesianCoordinates(baseCS, xval, yval, zval);

xval = (ptSE.X + ptNE.X) / 2.0;
yval = (ptSE.Y + ptNE.Y) / 2.0;
zval = (ptSE.Z + ptNE.Z) / 2.0;
ptM2.ByCartesianCoordinates(baseCS, xval, yval, zval);

xval = (ptNE.X + ptNW.X) / 2.0;
yval = (ptNE.Y + ptNW.Y) / 2.0;
zval = (ptNE.Z + ptNW.Z) / 2.0;
ptM3.ByCartesianCoordinates(baseCS, xval, yval, zval);

xval = (ptNW.X + ptSW.X) / 2.0;
yval = (ptNW.Y + ptSW.Y) / 2.0;
zval = (ptNW.Z + ptSW.Z) / 2.0;
ptM4.ByCartesianCoordinates(baseCS, xval, yval, zval);

//STEP 3: Draw the inner square based upon the midpoints
Polygon squareinner = new Polygon(this);
squareinner.ByVertices({ptM1, ptM2, ptM3, ptM4, ptM1});

}

part a: Within your procedure, you will first need to establish the outer square. You will need to calculate the values of a point the is mid-way between two other points. You will then need to establish a loop where each in series of inner rotated squares are defined at the mid-points of the sides of the preceding outer square. Save your procedure drwnsqr.gct to the submit directory.

part b(extra credit): Revise your procedure such that it draws inner squares at points 2/3 of the distance or 0.6667 of along the distance of each of the sides of the outer square. Save it in your submit directory under the name drwnsqr2.gct.


Problem 4:

Write a procedure mypat.gct that draws some recurring pattern in nature or architecture. You might look at descriptions in books in Islamic Geometry, or those of Serlio, Palladio, or Alberti. Or, you are free to choose an alternative geometry. The composition may be kept fairly simple.


What you need hand in:

1. Save and name your Macro procedures into your "submit" sub-directory through the Microstation save file procedure that have covered in class.

2. Send email to Earl Mark ejmark@Virginia.edu and to both David Malda dcm9b@virginia.edu and Michael Plehn mep4d@virginia.edu tthat describes the work you have done. Submit a few paragraphs documenting your research and any observations you may have made.

Feel free to visit or email Earl Mark should you be in need of assistance.

What is to come:
In the coming weeks we shall consider how geometry may be encoded using the Basic programming language to structure patterns of recurring pattern within a geometrical composition. We will look at how to separate out the larger compositional order of the master pattern from that of other patterns that are contained within it.


Microstation Manuals and Tutorials will be available on reserve at the Fine Arts Library and provided for use in workshops.