Program to create triangles on the surface , C/C++ Programming

Assignment Help:

Using your mountain project source code as a starting point, you are to write a code that randomly chooses one of the triangles on the surface of your mountain, this will be the entrance to your cave. A line segment representing that tunnel beginning at the centroid of that triangle travels a distance equal to the average of the three sides of that triangle in the direction normal to that surface INTO  the mountain. You should store this segment as a vector beginning at the centroid in the form  v = Xmi + y+ Zmk . These Xm, ym, and Zm  values will be referenced many times. At this point what happens is determined by the following table.

Probability

Event

0.10

Continue straight for the same distance as before

0.70

Tunnel changes direction  by generating  a new random vector direction such that when

v=ai  + bj + ck

-Xm < a< Xm

-Ym < b < Ym

-Zm < C < Zm

.10

The tunnel splits in two by generating two different vectors  in the same way as the change of direction table above

.10

Current tunnel  branch terminates

As the tunnel splits then there is an additional branch that must be explored. If at any time a branch of the tunnel intersects the surface of your mountain that branch should terminate (hint: consider the 2-d projection of your triangles as seen from above).

Save your tunnel system as a set of line segments in a separate data file then plot them with your mountain. They should automatically appear as a different color.


Related Discussions:- Program to create triangles on the surface

Constructor, how to use and what is implicit and explicit constructor

how to use and what is implicit and explicit constructor

Control flow, write the program to accept date and to say valid or invalid

write the program to accept date and to say valid or invalid

Specifying and working rules of a class, Specifying a Class: As discuss...

Specifying a Class: As discussed a class is defined to develop an algorithm and bind it together in a core shell. A class is an abstract data type (ADT).  The binding of dat

Padovan string, #questio#A Padovan string P(n) for a natural number n is de...

#questio#A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string

#Luminous Jewels, #Byteland county is very famous for luminous jewels. Lumi...

#Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Ne

Areaundercurve, Write a program to find the area under the curve y = f(x) b...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw .

In p = new fred(), Q: In p = new Fred(), does the Fred memory "leak" if  Fr...

Q: In p = new Fred(), does the Fred memory "leak" if  Fred constructor throws an exception? A: No.         If an exception take place during the Fred constructor of p = new F

Explain multilevel inheritance, Multilevel Inheritance In multilevel in...

Multilevel Inheritance In multilevel inheritance there is a parent class , from whom we derive another class . now from this derived class we can derive another class and so on

What is the use of pear in php, What is the use of PEAR in php? PEAR is...

What is the use of PEAR in php? PEAR is termed as PHP Extension and Application Repository. It provides structured library to PHP users and also gives provision for package mai

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd