CMPS109 Fall 2018 : Lab 2
In this lab you will implement a two-dimensional geometric bounds checker in C.
This lab is worth 7% of your final grade.
Submissions are due NO LATER than 23:59, Wednesday October 10, 2018. Late submissions will not be graded.
Background Information
The web is awash with information on the mathematics required to do the simple (and some not-so simple) geometric calculations required to complete this lab.
Teaching Servers & Accessing Your Home Directory
See Lab 1 for details: https://classes.soe.ucsc.edu/cmps109/Fall18/SECURE/CMPS109-Lab1.pdf Setup
SSH in to any of the CMPS109 teaching servers using your CruzID Blue credentials:
$ ssh <cruzid>@<server>.soe.ucsc.edu (use Putty http://www.putty.org/ if on Windows)
Authenticate with Kerberos:
$ kinit
Authenticate with AFS:
$ aklog
Create a suitable place to work: ( only do this the first time you log in ) $ mkdir -p ~/CMPS109/Lab2
$ cd ~/CMPS109/Lab2
Install the lab environment: ( only do this once )
$ tar xvf /var/classes/CMPS109/Fall18/Lab2.tar.gz
Make the skeleton system:
$ make grade
What to submit
In a command prompt:
$ cd ~/CMPS109/Lab2 $ make submit
This creates a gzipped tar archive named CMPS109-Lab2.tar.gz in your home directory. UPLOAD THIS FILE TO THE APPROPRIATE CANVAS ASSIGNMENT.
University of California Santa Cruz Baskin School of Engineering CMPS109 Fall 2018 Lab 2 Copyright © 2018 David C. Harrison. All rights reserved.
Requirements
Consider two two-dimensional shapes, A and B, in the same plane. A is considered contained by B when the entire boundary of A is inside the boundary of B.
For example, in the following diagrams the red triangle is contained by the blue circle, but the green circle is not contained by the cyan rectangle.
You are supplied with skeleton code defining four shapes, namely Circle, Triangle, Pentagon, and Reuleaux Triangle. Your task is to write a bounds checker capable of determining if one shape is inside another.
The lab archive comes complete with approximately two dozen tests comprised of assorted shapes contained or not contained by another. Study bounds.tests for details.
What you need to do
You will modify bounds.c to implement the contained_by()function.
More importantly, you should augment the simple tests supplied with more rigorous tests to convince
yourself your implementation is sufficient and complete.
You are encouraged to create your own test scripts but note that whilst these will be included in your submission, they will not be executed by the automated grading system and not count towards your grade.
To execute a batch of tests stand-alone after running make: $ ./bounds <name>.tests
Where <name>.tests is a file you created yourself with the same format as bounds.tests.
Notes:
- Do NOT modify bounds.h as is not included in the submission archive and if your code depends on
changes made it will fail to compile in the automated testing system and your will get no credit for
this lab.
- You can add additional source files (.c and .h files) and they will automatically be packed into your
submission archive.
- If you wish to use the standard C mathematics library in your solution, you will need to modify the
LIBS variable in Makefile.libs.
University of California Santa Cruz Baskin School of Engineering CMPS109 Fall 2018 Lab 2 Copyright © 2018 David C. Harrison. All rights reserved.
Grading Scheme
The following aspects will be assessed by executing your code on a machine with an identical configuration to the CMPS109 teaching servers:
1. (70 Marks) Does it work?
- Geometric Calculations (60 marks)
- Code free of warnings (10 marks)
For a, marks are deducted for any geometric calculations failing to produce the correct answer.
Note that the test scripts used by the automated grading system will NOT be the same as the trivial skeleton scripts provided in the lab environment you installed.
2. (-100%) Did you give credit where credit is due?
- Your submission is found to contain code segments copied from on-line resources and you failed to
give clear and unambiguous credit to the original author(s) in your source code (-100%)
- Your submission is determined to be a copy of another CMPS109 student’s submission (-100%)
- Your submission is found to contain code segments copied from on-line resources that you did give a clear an unambiguous credit to in your source code, but the copied code constitutes too significant a percentage of your submission:
o < 50% copied code
o 50% to 75% copied code o > 75%
No deduction (-50%) (-100%)
§
University of California Santa Cruz Baskin School of Engineering
CMPS109 Fall 2018 Lab 2
Copyright © 2018 David C. Harrison. All rights reserved.