Beruflich Dokumente
Kultur Dokumente
Advanced Databases
2. Using Triangles
Design diagrams can also be divided into sets of triangles and then recorded in database as such.
Each side of a triangle might need to be specified whether it should be drawn or not since it might be
part of boundry lines that are drawn in a diagram or it might not be.
3D desings can use triangulation technique. In this case it will be recorded whether each side is not
only a border side (or not) but also a front part or a back part that need to be drawn differently then
the front part. For example front parts will be drawn using solid lines and back parts using dotted
line.
BU, CS Department
Advanced Databases
2/4
BU, CS Department
Advanced Databases
3/4
BU, CS Department
Advanced Databases
4/4
Exercises
Exercise 1
1. Drawing an object:
a) Using a paper and a pencil to draw an object like a chair, table etc. that
looks like a 3-D object. (using a graph paper might make things easier)
b) Mark all the line segments in your drawing using x and y coordinates.
c) For each line segment also mark if it will be part of front view or back
view.
2. Create a table to store the line segments:
a) The table should be able to store x and y coordinates of both points of
your line segment.
b) The table should also store the object Id to which the line segment
belongs.
c) The table should also store whether a line segment is part of the front
view or the back view (for 3-D look).
3. Write and execute following queries:
a) Retrieve all line segments in ascending order on x and then y.
b) Retrieve all line segments that are part of front view in same order.
c) Retrieve all line segments that are part of back view in same order.
4. Use Visual Studio and C# to draw the line segments retrieved from the
database. (see the sample code for C# programming above.
Comments:
You can draw the line segments and fill colors in closed shapes.
You can use different color for front view and different for back view.
You can draw a street, divide it into line-segments, record each line
segment in a database and then find the distance between two points on
the street using the SQL queries.