Click here to Skip to main content
15,911,711 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Costing terrain paths [modified] Pin
Kevnar9-Nov-06 2:53
Kevnar9-Nov-06 2:53 
GeneralRe: Costing terrain paths Pin
ejuanpp9-Nov-06 3:21
ejuanpp9-Nov-06 3:21 
GeneralRe: Costing terrain paths [modified] Pin
Kevnar9-Nov-06 3:40
Kevnar9-Nov-06 3:40 
GeneralRe: Costing terrain paths Pin
ricecake9-Nov-06 4:09
ricecake9-Nov-06 4:09 
GeneralRe: Costing terrain paths Pin
Kevnar9-Nov-06 4:16
Kevnar9-Nov-06 4:16 
GeneralRe: Costing terrain paths Pin
ricecake9-Nov-06 4:37
ricecake9-Nov-06 4:37 
GeneralRe: Costing terrain paths [modified] Pin
Kevnar9-Nov-06 5:24
Kevnar9-Nov-06 5:24 
GeneralRe: Costing terrain paths Pin
ricecake9-Nov-06 5:48
ricecake9-Nov-06 5:48 
I'm not quite sure what you mean... From your other post, I think the way you have your terrain is basically a matrix of heights (just random numbers I picked):
+---+---+---+---+
| 3 | 2 | 2 | 1 |
+---+---+---+---+
| 5 | 6 | 7 | 8 |
+---+---+---+---+
| 6 | 9 | 9 | 7 |
+---+---+---+---+
| 4 | 6 | 5 | 4 |
+---+---+---+---+
Say, you wanted to find the angle between the '6' cell and the '7' cell in the middle of the matrix. If you think about like you're looking at the matrix from the side (as if you were actually looking at the terrain, but more like a cross-section), then the second row would look like:
            ---
        ---/ 8
    ---/ 7
---/ 6
 5
Assuming that the distance between cells (not counting diagonally) is 1 (as you said, for diagonally it should be sqrt(2)=1.414). So, if we just look at the 6 and 7 levels ("zoomed in"):
        -----
       /  7
      /
-----/
  6
we can make the triangle:
        -----
       /| 7
      / |
-----/--+
  6
So, I think you do want the difference in the terrain heights as your y.

--
Marcus Kwok

GeneralRe: Costing terrain paths Pin
Kevnar9-Nov-06 6:05
Kevnar9-Nov-06 6:05 
GeneralRe: Costing terrain paths Pin
ricecake9-Nov-06 6:46
ricecake9-Nov-06 6:46 
GeneralRe: Costing terrain paths Pin
Kevnar9-Nov-06 7:14
Kevnar9-Nov-06 7:14 
GeneralRe: Costing terrain paths Pin
ricecake9-Nov-06 7:21
ricecake9-Nov-06 7:21 
GeneralRe: Costing terrain paths Pin
Kevnar9-Nov-06 7:31
Kevnar9-Nov-06 7:31 
GeneralRe: Costing terrain paths Pin
ejuanpp9-Nov-06 3:43
ejuanpp9-Nov-06 3:43 
GeneralRe: Costing terrain paths Pin
Kevnar9-Nov-06 4:13
Kevnar9-Nov-06 4:13 
QuestionBeginners question? Where does the exact double value go? Pin
ClockDivider8-Nov-06 6:48
ClockDivider8-Nov-06 6:48 
AnswerRe: Beginners question? Where does the exact double value go? Pin
Rob Graham8-Nov-06 7:09
Rob Graham8-Nov-06 7:09 
GeneralRe: Beginners question? Where does the exact double value go? Pin
Dan Neely8-Nov-06 7:24
Dan Neely8-Nov-06 7:24 
GeneralRe: Beginners question? Where does the exact double value go? Pin
ClockDivider8-Nov-06 8:15
ClockDivider8-Nov-06 8:15 
QuestionScaling - help me Pin
dharani7-Nov-06 0:06
dharani7-Nov-06 0:06 
AnswerRe: Scaling - help me Pin
Jörgen Sigvardsson7-Nov-06 13:02
Jörgen Sigvardsson7-Nov-06 13:02 
GeneralBresenhams algorithm for drawing lines Pin
Jörgen Sigvardsson6-Nov-06 12:59
Jörgen Sigvardsson6-Nov-06 12:59 
GeneralRe: Bresenhams algorithm for drawing lines Pin
Luc Pattyn6-Nov-06 13:43
sitebuilderLuc Pattyn6-Nov-06 13:43 
GeneralRe: Bresenhams algorithm for drawing lines Pin
Jörgen Sigvardsson6-Nov-06 14:03
Jörgen Sigvardsson6-Nov-06 14:03 
GeneralRe: Bresenhams algorithm for drawing lines Pin
Bassam Abdul-Baki6-Nov-06 13:45
professionalBassam Abdul-Baki6-Nov-06 13:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.