Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 1 ) Write a program that inputs a topographical map and outputs the locations that are in the shade, given a certain predetermined position

(1) Write a program that inputs a "topographical" map and outputs the locations that are in the shade, given a certain predetermined position of the sun.
The input is an nn matrix representing n2 evenly spaced points on a square piece of land. The values in the matrix are integers ranging from 0 to 100. Each value represents the "altitude" of the land at the corresponding point.
The output is an nn matrix of 0s and 1s, where the output value is 0 if the land at that point is in the sunlight and 1 if the land at the point is in the shade.
Let us assume that the sun is shining from the west (W). A location is in the shade if there is a hill to its west high enough to block the sun. To compute which locations are in the shade: First, the locations in the leftmost column are by definition in the sunlight. For each remaining location (i, j), it is in the shade if there is another location (i,j-k) whose altitude is at least 4k greater than the altitude at (i, j). This is an "exhaustive" search for different locations with different i,j and k.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions