首页 > 文档 > vertex()顶点
2017
08-01

vertex()顶点

Name

vertex()顶点

   

Examples

vertex()顶点 - 第1张  | Processing编程艺术

beginShape(POINTS);

vertex(30, 20);

vertex(85, 20);

vertex(85, 75);

vertex(30, 75);

endShape();

vertex()顶点 - 第2张  | Processing编程艺术

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

vertex()顶点 - 第3张  | Processing编程艺术

size(100, 100, P3D);

PImage img = loadImage(“laDefense.jpg”);

noStroke();

beginShape();

texture(img);

// “laDefense.jpg” is 100×100 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();

Description

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().

所有形状都是通过连接一系列顶点来构造的。顶点 () 用于指定点、线、三角形、四边形和多边形的顶点坐标。它只在 beginShape () endShape () 函数中使用。

 

使用 z 参数在3D 中绘制顶点需要 P3D 参数与大小相结合, 如上例所示。

 

此函数还用于将纹理映射到几何图形上。纹理 () 函数声明要应用于几何图形的纹理, 而您和 v 坐标集定义了此纹理到窗体的映射。默认情况下, 用于您和 v 的坐标是相对于图像的大小 (以像素为单位) 指定的, 但可以使用 textureMode () 更改此关系。

Syntax

vertex(x, y)

vertex(x, y, z)

vertex(v)

vertex(x, y, u, v)

vertex(x, y, z, u, v)

Parameters

v

float[]: vertex parameters, as a float array of length VERTEX_FIELD_COUNT

顶点参数,作为顶点字段计数长度浮点数组

x

float: x-coordinate of the vertex

顶点的X坐标

y

float: y-coordinate of the vertex

顶点的Y坐标

z

float: z-coordinate of the vertex

顶点的Z坐标

u

float: horizontal coordinate for the texture mapping纹理映射的水平坐标

v

float: vertical coordinate for the texture mapping纹理映射的垂直坐标

Returns

void

Related

beginShape()
endShape()
bezierVertex()
quadraticVertex()
curveVertex()
texture()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。