This preview shows page 1. Sign up to view the full content.
Unformatted text preview: direction vector d. A rightangled
triangle is given by three points P1 , P2 and P3 (the right angle is at point P1 ).
Show in detail how you can calculate the intersection between the ray and the
face deﬁned by the triangle. Ray tracing:" c)! A point in the square triangle is given by
P = w1 u 1 + w2 u 2 + P 1
where u1 = P2 P1 , u2 = P3 P1 and
0 w1 1 0 w2 1
Department of Computing Examinations –+ w 2013 Session
0 w 2012  1
1 2 Conﬁdential MODEL ANSWERS and MARKING SCHEME
We ﬁrst determine the intersection of the ray with the plane deﬁned by the
First Examiner: Daniel Rueckertplane is given by
Second Examiner: Abhijeet Ghosh
triangle. The normal of the
Paper: C317  Graphics
Question: 2
Page 5 of 12
n = ± ( u1 ⇥ u2 ) / (  u1 ⇥ u2  )
The equation of the ray can be written as V + ad. The position of the
intersection q is given by
P1 + P = V + a d
P=V
Since P · n = 0: P1 + a d The equation of the ray can be written as V + ad. The position of the
intersection q is given by
P1 + P = V + a d Ray tracing" P=V P1 + a d Since P · n = 0:
0 = (V
a= (V P1 )n + adn
P1 )n/(dn) Now, we need to test whether the intersection point P is inside the triangle. Since
u1 and u2 are orthogonal, taking the dot product with u1 and u2 yields
w1 = (Pu1 P1 u1 ) / ( u1 u1 ) w2 = (Pu2 P1 u2 ) / ( u2 u2 ) For a valid intersection the following conditions must be met:
0 w1 1
0 w2 1 0 w1 + w2 1
Marks: 6 0 w1 + w2 1
Marks:
d 6 Ray tracing" a ray starts at V = (7, 7, 0) and has a direction vector
In a concrete example, d = (0, 0, 1). The points of the triangle are given as P1 = (6, 6, 10),
P2 = d)! 6, 10), and P3 = (6, 10, 5). Calculate whether the ray intersects the
(12,
face deﬁned by the triangle.
First, we calculate the normal of the plane deﬁned by the triangle:
u1 = (6, 0, 0)
u2 = (0, 4, 5) n = (0, 30, 24)or (0, 0.78, 0.62)
Calculating the intersection of the ray with the plane yields
a=
and ((7, 7, 0) (6, 6, 10))(0, 0.78, 0.62)/0.62 = (0.78 6.2)/0.62 = 8.74 Department of Computing Examinations – 2012  2013 Session Conﬁdential MODEL ANSWERS and MARKING SCHEME
First Examiner: Daniel Rueckert Second Examiner: Abhijeet Ghosh Ray tracing" Paper: C317  Graphics Question: 2 Page 6 of 12 P = (7, 7, 8.74)
Calculating the barycentric coordinates yields: w1 = ((7, 7, 8.74)(6, 0, 0) (6, 6, 10)(6, 0, 0))/36 = (42 w2 = ((7, 7, 8.74)(0, 4, 5) 36)/36 = 0.16 (6, 6, 10)(0, 4, 5))/41 = 0.25 0 w1 1
0 w2 1 0 w1 + w2 1 So the intersection point is inside the triangle.
Marks:
The four parts carry, respectively, 30%, 20%, 30%, and 20% of the marks. 4 Splines" 2 Splines A cubic spline patch is deﬁned by the parametric equation:
P ( µ ) = a3 µ3 + a2 µ2 + a1 µ + a0
where P(µ) is a point that traces the locus of the curve, with 0 < µ < 1 and a3 ,
a2 , a1 and a0 are vector constants that deﬁne the shape of the curve.
a Given that the patch is to be drawn between two points Pi and Pi+1 and the
0
0
gradients at the ends are to be Pi and Pi+1 respectively, write down four
00
equations connecting Pi Pi+1 Pi Pi+1 and a3 a2 a1 a0 . b Solve the above equations to ﬁnd the values in matrix A in the equation:
01...
View Full
Document
 Spring '14

Click to edit the document details