Files
processing4/web/reference/API/vertex.xml
2005-01-27 06:48:42 +00:00

102 lines
2.4 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>vertex()</name>
<category>Shape</category>
<subcategory>Vertex</subcategory>
<usage>Application &amp; Web</usage>
<example>
<image>vertex_.gif</image>
<code>
beginShape(POINTS);
vertex(30, 20);
vertex(85, 20);
vertex(85, 75);
vertex(30, 75);
endShape();
</code>
</example>
<example>
<image>vertex_2.gif</image>
<code>
noStroke();
BImage a = loadImage("arch.jpg");
beginShape();
texture(a);
// "arch.jpg" is 100x100 pixels in size so
// the values 0 and 100 are used for the
// parameters "u" and "v" to map it directly
// to the vertex points
vertex(10, 20, 0, 0);
vertex(80, 5, 100, 0);
vertex(95, 90, 100, 100);
vertex(40, 95, 0, 100);
endShape();
</code>
</example>
<description>
All shapes are constructed by connecting a series of vertices. <b>vertex()</b> is used to specify the vertex coordinates for points, lines, triangles, quads, and polygons and is used exclusively within the <b>beginShape()</b> and <b>endShape()</b> function. This function is also used to map a texture onto the geometry. The <b>texture()</b> function declares the texture to apply to the geometry and the <b>u</b> and <b>v</b> coordinates set define the mapping of this texture to the form. By default, the coordinates used for <b>u</b> and <b>v</b> are specified in relation to the image's size in pixels, but this relation can be changed with <b>textureMode()</b>.
</description>
<syntax>
vertex(<c>x</c>, <c>y</c>);
vertex(<c>x</c>, <c>y</c>, <c>z</c>);
vertex(<c>x</c>, <c>y</c>, <c>u</c>, <c>v</c>);
vertex(<c>x</c>, <c>y</c>, <c>z</c>, <c>u</c>, <c>v</c>);
</syntax>
<parameter>
<label>x</label>
<description>int or float: x-coordinate of the vertex</description>
</parameter>
<parameter>
<label>y</label>
<description>int or float: y-coordinate of the vertex</description>
</parameter>
<parameter>
<label>z</label>
<description>int or float: z-coordinate of the vertex</description>
</parameter>
<parameter>
<label>u</label>
<description>int or float: horizontal coordinate for the texture mapping</description>
</parameter>
<parameter>
<label>v</label>
<description>int or float: vertical coordinate for the texture mapping</description>
</parameter>
<returns>None</returns>
<related>
beginShape()
endShape()
bezierVertex()
curveVertex()
texture()
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
</root>