g the stack arising from a top-down parse of the two sentences. [4…
Question Answered step-by-step g the stack arising from a top-down parse of the two sentences. [4… g the stack arising from a top-down parse of the two sentences. [4 marks] (e) How might the sentence in Part (a)(ii) be altered so that it has the same meaning but is easier to process? Explain your reasoning. [4 marks] 5 (TURN OVER) CST1.2018.7.6 4 Further Graphics (a) Here are two methods for implementing a cube using signed distance fields: float methodOne(vec3 p) { return max(max(abs(p.x), abs(p.y)), abs(p.z)) – 1; } float methodTwo(vec3 p) { vec3 d = abs(p) – vec3(1); return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0)); } One is preferable to the other for producing better images faster. Which one, and why? [4 marks] (b) Complete the code below to implement the signed distance field function for a finite line segment with hemispherical end-caps (Figure 1) of arbitrary start point, end point, and radius. [4 marks] float lineSegment(vec3 p, vec3 start, vec3 end, float radius) { // [YOUR CODE HERE] } float getSdf(vec3 p) { return lineSegment( p, vec3(-PI, 0, 0), vec3(PI, 0, 0), 0.5); } (c) Implement a version of getSdf() that doubles the height of your line segment and translates it by −0.5 along the Z axis, to be centred at (0, 0, −0.5) (Figure 2). [4 marks] (d) Implement a version of getSdf() that warps the original line segment into a sine wave sin(X) (Figure 3). [4 marks] (e) Modify getSdf() to render the sine wave model subtracted from the taller model (Figure 4). (a) Write a GLSL function dartboard() which takes as input a texture co-ordinate texCoord which ranges from (0, 0) → (1, 1), and returns the colours of the procedural texture for a black-and-white dartboard pattern of 16 squares around and 8 squares in radius (see figure below). The background behind the dartboard is gray. vec3 dartboard(vec2 texCoord) { // [YOUR CODE HERE] } [6 marks] (b) What is . . . (i) the formula for the face angle α(F, vi) of face F at vertex vi of a closed manifold? [2 marks] (ii) the formula for the angle deficit AD(v) of vertex v and its surrounding set of faces {F}? [2 marks] (iii) the formula for the Poincar´e Formula of a surface with genus g and Euler characteristic χ? [2 marks] (iv) the formula for Descartes’ Theorem of Total Angle Deficit? [2 marks] (c) Consider a closed manifold surface with total angle deficit −4π. (i) If your hypothetical surface has 20 vertices and 20 faces then how many edges must it have? [2 marks] (ii) Sketch a picture of your surface. [4 marks] 8 CST1.2018.7.9 6 Further HCI (a) Explain in general how the actions that a user takes are related to the user’s goals. Your answer should make reference to the function of perception, and to the nature of the cognitive processing that must occur. [8 marks] (b) Describe a class of problems for which it is not possible to formulate goals. Give a specific example of a problem in this class, and with reference to that example, explain how it illustrates two significant attributes of the class. [6 marks] (c) If an interactive system has several alternative models to describe the user’s goal, how can Bayes’ theorem be used to improve the system usability? [6 marks] 9 (TURN OVER) CST1.2018.7.10 7 Further HCI Imagine that you have been asked to implement a radical new design of your college website. The Senior Tutor has decided that, to make the college seem friendlier, the home page and navigation should be implemented using a group photograph of all members of the college that was taken last summer. Your task is to design graphical content that will be overlaid onto the photograph to provide all necessary information and navigation. (a) Draw a sketch showing the main graphical features of your proposed design. (A few stick figures will be adequate to represent the original photograph. No additional marks will be given for realistic depictions of members of your college.) [4 marks] (b) Explain how the display plane of the photograph has been segmented in your proposed design, including explanation of any visual marks that were used to achieve this segmentation. [6 marks] (c) Choose five specific visual aspects of your proposed design, and for each of these five: (i) Describe the graphical property used to implement this aspect (by reference to your sketch); and (ii) Explain the mode of correspondence between this graphical property and the meaning that is intended in this aspect of your design. [10 marks] 10 CST1.2018.7.11 8 Prolog In this question you should ensure that your predicates behave appropriately with backtracking. You may not make use of extra-logical built-in predicates such as findAll. Use of the cut operator is permitted unless specified otherwise. You may ignore the possibility of overflow or division by zero. (a) A term can either be an atom, variable or a compound term. Define each of these. [3 marks] (b) Euclid’s algorithm for computing the greatest common divisor of two integers can be implemented in ML as: fun gcd(a,0) = a | gcd(a,b) = gcd(b, a mod b); Provide an implementation in Prolog without using the cut operator. [4 marks] (c) We can represent fractions using the compound term div/2. For example div(1,3) represents 1 3 . Implement a predicate simplify which transforms a fraction into its smallest exact representation. For example, simplify(div(8,4),B) should unify B with 2, and simplify(div(4,8),A) should unify A with div(1,2). Your predicate should avoid unnecessary computation. [5 marks] (d) We can also represent arithmetic expressions involving addition, subtraction, multiplication and division. For example, the expression 3 5 2−1 + 4 is represented as add(mul(3,div(5,sub(2,1))),4). Implement a predicate reduce which reduces an arithmetic expression to its smallest exact representation e.g. reduce(add(div(1,2),div(1,4)),A) should unify A with div(3,4)RKImage transcription textT. Let 31 denote the unit sphere m2 + y2 + 22 = 1, oriented outward, and let 5′; denote the sphere 2:3 +523 +222 4, oriented outward. Suppose F is s diEerentishle vector field on R3 such that div]?I = m2 + ya + z: and H3. F .es = e. What is fig: F – so? 3. Let c he s. constant and consider the vector field F = (xi + 3:2 + are, … Show more… Show more Computer Science Engineering & Technology C++ Programming COMP 5370 Share QuestionEmailCopy link Comments (0)


