mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 01:50:44 +01:00
81 lines
1.5 KiB
XML
81 lines
1.5 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<root>
|
|
<name>dist()</name>
|
|
|
|
<category>Math</category>
|
|
|
|
<subcategory>Calculation</subcategory>
|
|
|
|
<usage>Web & Application</usage>
|
|
|
|
<example>
|
|
<image>dist_.jar</image>
|
|
<code>
|
|
// Sets the background gray value based on
|
|
// the distance of the mouse from the center
|
|
void loop() {
|
|
float d = dist(50, 50, mouseX, mouseY);
|
|
fill(d*4);
|
|
rect(0, 0, 99, 99);
|
|
}
|
|
</code>
|
|
</example>
|
|
|
|
<description>
|
|
Calculates the distance between two points.
|
|
</description>
|
|
|
|
<syntax>
|
|
dist(<c>x1</c>, <c>y1</c>, <c>x2</c>, <c>y2</c>);
|
|
dist(<c>x1</c>, <c>y1</c>, <c>z1</c>, <c>x2</c>, <c>y2</c>, <c>z2</c>);
|
|
</syntax>
|
|
|
|
<parameter>
|
|
<label>x1</label>
|
|
<description>int or float: x-coordinate of the first point</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>y1</label>
|
|
<description>int or float: y-coordinate of the first point</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>z1</label>
|
|
<description>int or float: z-coordinate of the first point</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>x2</label>
|
|
<description>int or float: x-coordinate of the second point</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>y2</label>
|
|
<description>int or float: y-coordinate of the second point</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>z2</label>
|
|
<description>int or float: z-coordinate of the second point</description>
|
|
</parameter>
|
|
|
|
<returns>float</returns>
|
|
|
|
<related></related>
|
|
|
|
<availability>1.0</availability>
|
|
|
|
<type>Function</type>
|
|
|
|
<partof>PDE</partof>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</root>
|