Elif Tosun
274b-ab
Spring 2000
CGAL
SUMMARY OF Week3:
This week, I worked on compiling and running some example programs as I followed the "Getting Started with CGAL" document, Chapter 2. As I ran and compiled the programs, if possible I created Cinderella drawings of what was happening in the programs.
Ch #2: Elementaries
Chapter 2.1: Points and Vectors
Example file: examples/Getting_started/basic.C (I don't have the link ready yet, but it will be here soon)
When we compile and run the program*, the output is:
Vector v2 has coordinates: (3, 4)
Point p3 has coordinates: (8, 31)
(* To compile I needed to modify the makefile and just type "make basic"
To run the program I needed to type "./basic")
Notes on the structure of the program
:First include file is "tutorial.h". It contains some definitions that make the example programs easier to read.Then, there are the header files that define CGAL points and vectors.Then, there is the I/O file, since the program outputs results.
** Order is really important. "tutorial.h" has to go first.
There are 3 2D points. The first two are initialized whereas the thrid one isn't. There are 2 vectors. The first one is initialized the same way as the points. The third one is initialized as a difference of two points.
Vectors can be added, and it results with a new vector. A vector can be multiplied by a vector. A vector can be added to another one and it would result in another point.
Chapter 2.2: Difference between points and vectors
A point is a general object. It has a position in 2D space. It can lie on a line, or inside a triangle. It has a distance to another pt.
Vectors are not geometric objects, like points. It is a difference of two points. They can be added and subtracted, and they can be multiplied by a scalar.
*CGAL also has a constant called ORIGIN, that can be used in any dimensional space.