User Tools

Site Tools


crpl:docs:distance

<- CRPL reference <- Utility Commands

Distance

ArgumentsResultNotation
Two sets of coordinates x1,y1 x2,y2 x1 y1 x2 y2– f1

Description

Calculates the distance between two map points (x1,y1) to (x2,y2) and pushes the resulting floating point number to the stack.

Examples

# 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
crpl/docs/distance.txt · Last modified: 2019/02/27 01:18 by Karsten75