New folder/dvhmaincc.txt
#embody “/public/learn.h” utilizing namespace std; //GL; HF int foremost()

New folder/INSTRUCTION-DVH.txt
Background: NVIDIA RTX graphics hards have help for a knowledge construction known as a Bounding Quantity Hierarchy, or BVH for brief. It’s primarily simply rectangles within rectangles… that is it. The larger rectangles are used to shortly reject collisions and tracelines – if a line does not cross the massive rectangle, then it might probably’t intersect any of the rectangles inside it. If you happen to’re intelligent when constructing your BVHs, this lets you shortly decide what rectangle is hit by what ray, and therefore can do ray tracing in actual time. We’re not doing ray tracing graphics for this task, we’re simply going to construct a BVH, and do a bunch of attention-grabbing issues with it, equivalent to validating that the map information is right, and seeing which crates in a warehouse get shot essentially the most. It is a greenfield task, which means you are given no Makefile, and mainly an empty foremost.cc. You’re accountable for creating lessons (utilizing correct class design) for a Ray class, a Rectangle class, a Level class, and anything you’ll be able to consider, and splitting the undertaking into completely different .h and .cc recordsdata, and utilizing a Makefile you write to construct the undertaking. I’ve pattern Makefiles in /public, and I even have some hints (primarily within the type of feedback) in /public/rtx_on/hints.cc which may provide you with some concepts. However I like to recommend making an attempt to do the undertaking with out the hints as a lot as attainable. As soon as in the course of the undertaking, you’ll be able to inform me “The Beacons are lit. Gondor requires Help.” and I will provide you with a related code snippet that you should use in your undertaking. Use this if you happen to get caught. There’s a whole lot of simple level pickups from doing issues like error checking and map validation, so even if you happen to do not assume you’re going to have the ability to end the undertaking, it’s best to not less than begin the undertaking and get as many factors as you’ll be able to. You would possibly discover it will get simpler when you get into the groove. As all the time, do not wait to the final minute to start out the undertaking. Begin early so you’ll be able to ask for Help early. ============== The Map Format ============== The map file holds a bunch of rectangles. A number of the rectangles are stable, and you may consider them like crates in a warehouse. They are often enclosed by a non-solid rectangle, and people rectangles are simply there to make the intersection testing and such go quicker. If a line does not cross a non-solid rectangle, then it can not hit any rectangle inside it. Good! The format is: Strong(1)/Nonsolid(zero) x_min y_min x_max y_max (record of kids iff not stable) The record of kids are line numbers (the traces begin at zero) of stable rectangles contained in the non-solid rectangle. Strong rectangles shouldn’t have youngsters. All non-solid rectangles will need to have youngsters. This is a pattern file: zero zero zero 100 100 1 2 1 1.1 1.zero 1.2 1.three 1 10 10 11 11 zero 50 60 70 80 Four zero 55 65 65 75 5 1 56 66 64 74 The primary line (line zero) is a non-solid rectangle with two youngsters (the following two rows, traces 1 and a pair of). The primary rectangle ranges from (zero,zero) to (100,100). The kids of it are each small stable rectangles, the primary is simply .1 x .three, starting from (1.1,1.zero) to (1.2,1.three) and the second is only one x 1, starting from (10,10) to (11,11). The fourth line (line three) is a second non-solid rectangle. This one accommodates solely a single non-solid rectangle, and that one accommodates a single stable rectangle. Doable errors: 1) A non-solid rectangle has no youngsters (having a non-solid youngster is okay) 2) A minimal worth is >= the utmost worth (so if the minimal x is 10, the utmost x cannot be 9, and so on.) three) A toddler of a rectangle stands proud from the mother or father rectangle (all youngsters have to be fully enclosed by the mother or father) ========== Pictures File The photographs file holds an inventory of photographs (think about some hitscan weapon in a online game like a shotgun or one thing). Every shot has an origin and a course. The origin is an (x,y) coordinate, like (5,three). The course is a slope and whether or not the shot is touring alongside that slope or within the reverse. A slope of “Vertical” implies that the shot is travelling straight up and down. The format is: x_location y_location slope(both a quantity like 2.1 or a non-number which means “Vertical”) forwards(1 which means forwards, zero which means backwards) zero zero zero zero zero zero zero 1 zero zero Vertical zero zero zero Squirrel 1 10 10 -1 1 -10.1 -100.01 2.1 zero The primary line is a horizontal line taking pictures left from the origin (zero,zero). The second line is a shot additionally travelling horizontally from the origin, however ahead alongside the x axis as an alternative of backwards. The third line is taking pictures straight down out of the origin The fourth line is taking pictures straight up out of the origin (any non-number means Vertical, not simply Vertical) The fifth line is travelling diagonally down and to the proper out of (10,10) The sixth line is travelling steeply (slope: 2.1) down and to the omitted of (-10.1,-100.01) Issues to be careful for: ensure you can deal with damaging slopes in addition to non-numbers (like “vertical” or “squirrel” or “-“) which all imply the shot is vertical. ================== Menu of Operations ================== You begin off by printing an RTX banner with figlet, after which load a map file and a photographs file. If there’s any errors in these recordsdata (like a min worth being >= a max worth) give up instantly. Then print this: 1) Print the world of containers 2) Print the record of photographs three) Verify the containers for correctness Four) See if two rectangles overlap 5) See if a ray hits a rectangle 6) Output an inventory of all stable containers colliding 7) Fireplace all photographs and see which field is getting hit essentially the most Please enter selection: You will need to implement every of the 7 operations, however if you happen to do not need to do all of them and are effective with not a 100%, then I would implement them so as, as I kind of ordered them by problem. Every operation runs as soon as after which quits. Whereas inconvenient, it makes it simpler so that you can decide up extra factors in check circumstances. === Operation 1 – Print the map information === For the pattern map above, it could seem like this: (zero.00,zero.00) to (100.00,100.00) NOT SOLID Youngsters: 1 2 (1.10,1.00) to (1.20,1.30) SOLID (10.00,10.00) to (11.00,11.00) SOLID (50.00,60.00) to (70.00,80.00) NOT SOLID Youngsters: Four (55.00,65.00) to (65.00,75.00) NOT SOLID Youngsters: 5 (56.00,66.00) to (64.00,74.00) SOLID (NOTE THAT ALL NUMBERS ARE ROUNDED TO EXACTLY TWO DECIMAL PLACES ALWAYS) === Operation 2 – Print the shot information === For the pattern photographs file given above, it could print out this: (zero.00,zero.00) Slope: zero.00 Backwards (zero.00,zero.00) Slope: zero.00 Forwards (zero.00,zero.00) Slope: Vertical Backwards (zero.00,zero.00) Slope: Vertical Forwards (10.00,10.00) Slope: -1.00 Forwards (-10.10,-100.01) Slope: 2.10 Backwards === Operation three – Map Verify === It is pretty widespread to have recordsdata containing information, and for packages who load the information to not do a whole lot of checking at load time for velocity causes. However they nonetheless must be checked to ensure they do not comprise errors, so perhaps the map making software or a separate mapcheck software would possibly exist to search for errors. On this case, it will search for any rectangles that reach out of their mother or father rectangle. For instance, if you happen to had this file zero 10 10 20 20 1 1 15 15 25 25 This might have a mother or father rectangle from (10,10) going to (20,20) nevertheless it’s youngster goes from (15,15) to (25,25), which means it isn’t enclosed by the mother or father rectangle. This defeats the entire level of a BVH, which is to make intersection exams with massive numbers of rectangles quick by enclosing them in a rectangle. If any stick out, then it simply does not work. Your code ought to print: Map Right if the map is right, or Map Error: Field 1 if the map has an error. Give up on the primary youngster rectangle that stands proud from a mother or father. The field quantity is its line within the file (traces begin at zero). === Operation Four – Rectangle/Rectangle Intersection === This operation does not use the maps file. You simply manually enter two rectangles and it tells you in the event that they intersect or not. It is designed to allow you to check your algorithm to see if two rectangles intersect. Instance: Please enter the min and max factors for a Rectangle (instance: zero zero 10 20 to make a field from (zero,zero) to (10,20)): zero zero 10 10 After which once more for a second Rectangle: 9.9 9.9 10.1 10.1 They intersect! Instance 2: Please enter the min and max factors for a Rectangle (instance: zero zero 10 20 to make a field from (zero,zero) to (10,20)): -10 -10 -5 -5 After which once more for a second Rectangle: -Four -Four 10 10 They do not intersect === Operation 5 – Ray/Rectangle Intersection === That is much like #Four besides you are testing to see if a Ray hits a Rectangle. Instance: Please enter the min and max factors for a Rectangle (instance: zero zero 10 20 to make a field from (zero,zero) to (10,20)): 5 1 6 100 Please enter a shot (for instance: zero 5 1.1 1 means it comes from (zero 5) heading up at a slope of 1.1 within the forwards course): zero three 5 1 HIT! Location: (5.00,28.00) Instance 2: Please enter the min and max factors for a Rectangle (instance: zero zero 10 20 to make a field from (zero,zero) to (10,20)): -10 -10 -5 -5 Please enter a shot (for instance: zero 5 1.1 1 means it comes from (zero 5) heading up at a slope of 1.1 within the forwards course): -Four -9 2.1 1 MISS! === Operation 6 – Collision Detection === This one is simply Operation Four, however throughout the entire map. For all stable rectangles on the map, you output all the opposite stable rectangles it’s touching, if their row quantity is greater. Instance Map File: zero zero zero 100 100 1 2 three Four 5 1 1 1 2 2 1 10 10 11 11 1 1 30 31 60 1 90 zero 100 10 1 -100 -100 100 100 1 99 99 101 101 Instance Output: Field 1 and Field 5 intersect. Field 2 and Field 5 intersect. Field three and Field 5 intersect. Field Four and Field 5 intersect. Field 5 and Field 6 intersect. If there are not any intersections it prints “No containers overlapped!” === Operation 7 – Pictures Fired === This one is simply Operation 5, however throughout the entire map. For all photographs within the photographs file you see which field received hit within the maps file. The field that received hit essentially the most you print: Field three received hit essentially the most And give up. That is it! Good luck! Have enjoyable!

New folder/map1.txt
zero zero zero 100 100 1 2 three Four 1 1 1 2 2 1 10 10 11 11 1 1 30 31 60 1 90 zero 100 10

New folder/map2.txt
zero zero zero 100 100 1 2 three Four 5 1 1 1 2 2 1 10 10 11 11 1 1 30 31 60 1 90 zero 100 10 1 -100 -100 100 100 1 99 99 101 101

New folder/map3.txt
zero zero zero 100 100 1 2 1 1.1 1.zero 1.2 1.three 1 10 10 11 11 zero 50 60 70 80 Four zero 55 65 65 75 5 1 56 66 64 74

New folder/photographs.txt
zero zero zero zero zero zero zero 1 zero zero Vertical zero zero zero Vertical 1 10 10 1 1 -10.1 -100.01 2.1 zero

New folder/shots2.txt
zero zero zero.5 1 1.5 zero — 1 zero 1.2 zero 1 zero zero.5 zero 1

New folder/shots3.txt
1.1 1.1 1.1 1 1.1 1.1 1.1 zero 1.1 1.1 -1.1 1 1.1 1.1 -1.1 zero -1.1 1.1 -1.1 1 -1.1 1.1 1.1 zero 1.1 -1.1 -1.1 1 -1.1 -1.1 -1.1 zero -1.1 -1.1 1.1 1

Published by
Medical
View all posts