User Tools

Site Tools


opus:fall2012:mkelly23:part3

Part 3

Entries

Entry 1: November 8th, 2012

Today in Discrete, we were introduced to a program that Matt created to draw an image in C. To do so, we had to utilize the gd library, compiling against -lgd to output a viewable image in a web browser.

In order to correctly draw the image, we had to first know the dimensions of our viewable window. Individual colors were set through distinct bit patterns. The image placement and shape formation, however, relied solely on mathematic algorithims. Equations were used to obtain the desired output for the x and y coordinates, causing the image to be placed where and how we wanted it to.

Entry 2: November 9th, 2012

At the start of Data Structures, a formal due-date for “Binary Trees” was set for the first week of December. The idea is to utilize a variation of a linked-list to implement the tree. The class lecture was focused on a review of Makefiles. Some of the class had been using Makefiles throughout the semester, while others (including myself) had not.

I learned that a Makefile was, in essence, a program within itself. Makefiles consist of variables (ALL CAPS) and CFLAGS placed to invoke the compiler. The language standards are supported by GCC. A great length of time was spent reviewing the manual page for GCC, where we learned the different ways that GCC can be used, and most of its attributes.

Entry 3: November 14th, 2012

In Data Structures today, we took a look at a program that Matt had written to implement stacks. This program was meant to bridge the gap amongst the class, and give everyone a solid program to base future work off of. In comparison to my working stack program, I found a lot of similarities. That was a good indication to me that I was learning more and more about how to program in C!

Matt's hope was that we would utilize his stacks program in building our binary trees. To this point, I was still unsure of how to best tackle the assignment. I did a lot of research online, and looked at sample code that others had posted. Unfortunately, I found that I didn't gain as much from this as I had anticipated.

Entry 4: November 29th, 2012

Dr. Marian Eberly graced us with her presence today. She came to observe Matt's teaching techniques, and to see what happens in the Almighty LAIR.

The class was focused on a revisiting of the gd library, and creating images in C programming. The goal of the day was to create an accurate Corning Community College logo. I found this assignment a nice change of pace, and the perfect balance of difficulty and entertainment.

We first reviewed how to access images, and output into a format that could be viewed on a web page. The discussion then shifted into how to properly place the CCC logo on the screen. When broken down, the logo is nothing more than a series of three half circles. Our first step was to determine where the first “C” needed to be placed, and how to avoid the image from overlapping a 12% border that we chose to implement.

As we worked through an equation to set the margins and place the first half circle, we found that the “C” displayed properly, but significantly smaller than intended. The rest of class time was spent working independently, trying to rectify the issue.

I found this class time to be one of the more rewarding classes of the semester, where I was able to find a practical application for C (different from making stacks, linked lists, etc).

Keywords

data Keyword 3

Identification of chosen keyword.

Definition

Definition (in your own words) of the chosen keyword.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

data Keyword 3 Phase 2

Valgrind

Definition

A suite of tools used for debugging an existing program. Like Gcc, it uses a powerful debugging tool used by programmers to find breakpoints in their code.

References

Demonstration

Demonstration of the indicated keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

discrete Keyword 3

Identification of chosen keyword.

Definition

Definition (in your own words) of the chosen keyword.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

discrete Keyword 3 Phase 2

Permutation

Definition

A way, esp. one of several possible variations, in which a set or number of things can be ordered or arranged

References

Demonstration

Demonstration of the indicated keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

Experiment 3

Question

Building On the CCC Logo:

How can I adjust the size of the Corning Community College logo to properly fit on the screen, with respects to the pre-determined margins?

Resources

For this experiment, there is no need to utilize web resources. I intend to use the image program (graph.c) that Matt had given us earlier in the month, as well as my understanding of Mathematics to properly create the Corning Community College logo.

Hypothesis

Can applying the rules of Mathematics help with creating a properly-sized logo?

To test my hypothesis, I will implement a value for pi. In Mathematics, pi has a set value; in C Programming, however, pi is not inherently recognized. Pi is useful in determining the size of circular shapes, and will be utilized in my program.

Experiment

I will test my experiment for creating a variable called pi, and assigning a rounded value of 3.14. I will then place pi into the equation for caluclating the radius of a circle in C, in order to return the optimum result.

Data

After initiating the variable pi to 3.14, I placed pi into the three half circle equations, multiplying each radius by the value of pi.

<code>

      gdImageFilledArc(img, ((rm-lm)/3+lm), ((bm-um)/2 + um), ((**pi***(rm-lm)/3+lm)/2),
      ((**pi***(rm-lm)/3+lm)/2), 90, 270, color[RED], gdArc);
      gdImageFilledArc(img, (((rm-lm)/3+lm)+((**pi***(rm-lm)/3+lm)/2)/2), ((bm-um)/2 + um),$
      ((**pi***(rm-lm)/3+lm)/2), 90, 270, color[RED], gdArc);
      gdImageFilledArc(img, ((rm-lm)/3+lm)+((**pi***(rm-lm)/3+lm)/2), ((bm-um)/2 + um), ((p$
      ((**pi***(rm-lm)/3+lm)/2), 90, 270, color[RED], gdArc);
      

Analysis

Based on my data, I was able to properly replicate the Corning Community College logo. Each “C” was properly placed on the screen, and at the appropriate size. The image stayed balanced within the 12% margins that we had designated in class yesterday.

Unfortunately, it is difficult to tell if my implementation of pi into the radius algorithim will work in all cases. It is quite possible that I was scientifically “lucky” in this instance. Given time constraints (and the need to focus on other assignments), I was unable to test another instance of using pi to create other circles.

Conclusions

What can you ascertain based on the experiment performed and data collected? Document your findings here; make a statement as to any discoveries you've made.

opus/fall2012/mkelly23/part3.txt · Last modified: 2012/11/30 13:43 by mkelly23