Skip to content

vahidsamimi/XIBIX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

XIBIX

View spot finder
There is a map excerpt of a hilly landscape. We call it a mesh. The mesh is partitioned in triangles; we call them elements. For each element a scalar value is assigned, which represents the average spot height in this triangle as compared to the sea level.

For a walking tour we would like to identify the view spots. A view spot is the element where the height reaches its local maxima, that is, all the neighboring elements are not higher. We consider two elements as neighbors if they share at least one node – vertex. The task is as follows: Given a mesh and an integer number N, find the first N view spots ordered by the spot height starting from the highest to the lowest.

Input

1. A JSON file with the mesh and the height values. The file contains three sections:
{
 nodes: [
 {id: node_id1, x: <number value>, y: <number value>}, 
 {id: node_id2, x: <number value>, y: <number value>},
 {id: node_id3, x: <number value>, y: <number value>},
 ...
 ],
 elements: [
 {id: element_id1, nodes: [node_id1, node_id2, node_id3]},
 ...
 ],
values: [
 {element_id: element_id1, value: <number value>},
 ...
 ]
}

2. Integer number N that defines how many view spots must be found and written out.

Output

List of N view spots (view spot element ID, height value on this element) ordered by value from the highest to the lowest.

Run

```
node [program name].js <mesh file> <number of view spots>
node .\App.js .\Data\mesh[1][1][1][1][1][1].json  10
```

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published