Question: The assignment is a simple exercise to implement a simpler Scene graph using as much parallelism as possible in cuda c + + language. Given

The assignment is a simple exercise to implement a simpler Scene graph using as much parallelism as
possible in cuda c++ language. Given multiple images as matrices (meshes) in gray-scale along with their initial positions, a
multi-set of translations, and their relationship to one another, you are to cast a scene of given dimensions.
The initial positions of the images are presented as (x,y) coordinates denoting the position where the
top most, left most pixel of the image would be placed in the scene matrix.
The relationships between the images are represented by an edge list. Note that an edge from image a to
image b would mean that they translate together. In other words, if image a is translated in some direction
on the 2D plane, image b would have to be translated in the same direction by the same amount. However,
if image b is moved, this need not be reflected in a.
The translations here are transitive, i.e, if there is an edge from a to b and another edge from b to c, if a
is moved, the movement will have to be reflected in c as well. The Test cases will assure that the resultant
graph formed by the edges is a tree. The tree will always be rooted at 0.
While the images move, overlaps may happen. On such occasions, the more opaque matrix shall be
visible in the overlapping regions (opacity of matrices are provided along with the matrix descriptions in the
test cases). The opacity values are guaranteed to be unique per mesh.2 Input and Output Format :
2.1 Input Format :
In each test-case,
The first line contains n, the number of meshes.
The second line contains RC, the size of the scene (RC).
This is followed by n descriptions for the n meshes respectively. Each of the description,
-Starts with rc, the size of the mesh along x and Y directions
-followed by xy, the starting coordinates of the mesh.
-The next line has the opacity of the mesh.
-The next r lines have c integers, together defining a mesh (rc).
The description of n meshes is followed by the description of edges. The edges description,
-starts with number of edges
-Followed by E lines. Each line is of the format ab, which represents an edge from mesh a to b,a
b.
Next follows the description of translations to be applied. The description,
-Starts with T(the number of translations), followed by T lines, one for each translation.
-Each of the T lines has, NCA, where N is the mesh number on which the translation has to be
applied, C is the translation command, A is the amount.
The command C of a translation can be of the following type:
Table 1: Translation commands
Transaltion Command - Transaltion
0-UP
1-DOWN
2-LEFT
3-RIGHT
2.2 Output Format :
Print out the resultant Scene as an RC matrix. (R lines, each containing C integers).
3 Sample Test Case :
3.1 Sample Input :
3
1111
75
35
1
25224912110782
201923322645
8114231868
87391675212
20882130119117
271537423788
611068254213
29
47
3
149956053181196140221108
17506122618018089207206
56
93
2
24915025230224102
441412314020248
66143188159123206
209184177135236138
21418746219914
2
01
12
2
121
224
3.2 Sample Output :
00000000000
00000000000
00000000000
00000252249121107820
0000020149956053181
0000081175061226180
00000873916752120
00000208821301191170
000002715374237880
2523022410206110682542130
123140202480000000
3.3 Constraints :
n10000000(107)
R10000 and C10000
r100 and c100
T10000000(107)
summation of r**c across all n meshes 100000000(108)
opacity of a mesh 30000000(3108)
A100
C3
Starter code i.e main function is provided in the image .Considering this main function write your code.please use cuda c++ language .
 The assignment is a simple exercise to implement a simpler Scene

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!