vertex()

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

名称

vertex()

示例
 beginShape(POINTS);

vertex(30, 20);

vertex(85, 20);

vertex(85, 75);

vertex(30, 75);

endShape();

 // Drawing vertices in 3D requires P3D // as a parameter to size() size(100, 100, P3D);

beginShape(POINTS);

vertex(30, 20, -50);

vertex(85, 20, -50);

vertex(85, 75, -50);

vertex(30, 75, -50);

endShape();

 size(100, 100, P3D);

PImage img = loadImage("laDefense.jpg");

noStroke();

beginShape();

texture(img);

// "laDefense.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();

描述 All shapes are constructed by connecting a series of vertices. vertex() is used to specify the vertex coordinates for points, lines, triangles, quads, and polygons. It is used exclusively within the beginShape() and endShape() functions.

Drawing a vertex in 3D using the z parameter requires the P3D parameter in combination with size, as shown in the above example.

This function is also used to map a texture onto geometry. The texture() function declares the texture to apply to the geometry and the u and v coordinates set define the mapping of this texture to the form. By default, the coordinates used for u and v are specified in relation to the image’s size in pixels, but this relation can be changed with textureMode().

语法
vertex(x, y) vertex(x, y, z) vertex(v) vertex(x, y, u, v) vertex(x, y, z, u, v)
参数
v float[]: vertex parameters, as afloat array of length VERTEX_FIELD_COUNT
x float: x-coordinate of the vertex
y float: y-coordinate of the vertex
z float: z-coordinate of the vertex
u float: horizontal coordinate for the texture mapping
v float: vertical coordinate for the texture mapping
返回值 void
相关 beginShape()
endShape()
bezierVertex()
quadraticVertex()
curveVertex()
texture()

Updated on October 2, 2018 05:02:08pm EDT

vertex()