User Tools

Site Tools


crpl:docs:distance

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
crpl:docs:distance [2014/10/01 15:02] – external edit 127.0.0.1crpl:docs:distance [2019/02/27 01:18] – [Distance] added example Karsten75
Line 1: Line 1:
-~~DISCUSSION~~ 
 <- [[crpl:crplreference|CRPL reference]] <- [[crpl:crplreference#utility_commands|Utility Commands]] <- [[crpl:crplreference|CRPL reference]] <- [[crpl:crplreference#utility_commands|Utility Commands]]
 =====  Distance  ===== =====  Distance  =====
Line 10: Line 9:
 Calculates the distance between two map points (x1,y1) to (x2,y2) and pushes the resulting floating point number to the stack. Calculates the distance between two map points (x1,y1) to (x2,y2) and pushes the resulting floating point number to the stack.
 === Examples === === Examples ===
-<code>example goes here</code> +<code> 
 + 
 +# terrain modification script to build a circular pyramid 
 + 
 +50 -> centerX  
 +50 -> centerY 
 +20 -> height 
 + 
 +do (<- height add(1) <-height mul(-1)) 
 +  do (<-height add(1) <-height mul(-1)) 
 +    <-centerX add(I) ->x 
 +    <-centerY add(J) ->y 
 +    distance( <-x <-y <-height sub(<-dist)) 
 +  loop 
 +loop 
 +</code> 
  
  
crpl/docs/distance.txt · Last modified: 2024/05/13 14:45 by kaiden