hypot
Prev | Orchestra Opcodes and Operators | Next

## hypot

hypot — Euclidean distance function.

## Description

Returns the value of sqrt(arg1*arg1+arg2*arg2).

## Syntax

    ires[] hypot iarg1[], iarg2[]

    kres[] hypot karg1[], karg2[]

## Initialization

iarg[]1/2 -- the operands.

## Performance

karg[]1/2 -- the operands

## Examples

Here is an example of the hypot opcode. It uses the file hypot.csd.

Example 438. Example of the hypot opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    </CsOptions>
    <CsInstruments>

    instr 1

    iArg1[] fillarray 1,2,3
    iArg2[] fillarray 4,5,6
    iRes[] hypot iArg1,iArg2
    ik init 0

    while ik < lenarray(iRes) do
     print iRes[ik]
     ik += 1
    od

    endin

    </CsInstruments>
    <CsScore>
    i1 0 0
    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: Victor Lazzarini
2017

Prev | Up | Next
hvs3 | Home | i