p5 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accessibility/color_namer.js +5 -5
- package/dist/accessibility/describe.js +10 -0
- package/dist/accessibility/index.js +5 -5
- package/dist/accessibility/outputs.js +21 -0
- package/dist/app.js +5 -5
- package/dist/color/color_conversion.js +5 -5
- package/dist/color/creating_reading.js +1 -1
- package/dist/color/index.js +2 -2
- package/dist/color/p5.Color.js +1 -1
- package/dist/color/setting.js +2 -2
- package/dist/{constants-C-g_eAdC.js → constants-tYr0tCl8.js} +19 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +6 -5
- package/dist/core/friendly_errors/fes_core.js +1 -1
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +41 -75
- package/dist/core/friendly_errors/sketch_reader.js +5 -5
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/friendly_errors/validate_params.js +5 -5
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +5 -5
- package/dist/core/legacy.js +5 -5
- package/dist/core/main.js +5 -5
- package/dist/core/p5.Graphics.js +4 -4
- package/dist/core/p5.Renderer.js +3 -3
- package/dist/core/p5.Renderer2D.js +5 -5
- package/dist/core/rendering.js +4 -4
- package/dist/{creating_reading-D4AAKRbx.js → creating_reading-Cr8L2Jnm.js} +2 -2
- package/dist/dom/dom.js +10 -10
- package/dist/dom/index.js +2 -2
- package/dist/dom/p5.Element.js +2 -2
- package/dist/dom/p5.MediaElement.js +2 -2
- package/dist/events/acceleration.js +24 -24
- package/dist/events/keyboard.js +1 -2
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +4 -4
- package/dist/image/image.js +4 -4
- package/dist/image/index.js +4 -4
- package/dist/image/loading_displaying.js +4 -4
- package/dist/image/p5.Image.js +3 -3
- package/dist/image/pixels.js +1 -0
- package/dist/io/files.js +4 -4
- package/dist/io/index.js +4 -4
- package/dist/io/p5.TableRow.js +2 -2
- package/dist/{main-s72KWcUy.js → main-CAxvgiOV.js} +12 -9
- package/dist/math/Matrices/Matrix.js +1 -1
- package/dist/math/Matrices/MatrixNumjs.js +1 -1
- package/dist/math/index.js +1 -1
- package/dist/math/math.js +1 -1
- package/dist/math/p5.Matrix.js +1 -1
- package/dist/math/p5.Vector.js +1 -1
- package/dist/math/trigonometry.js +1 -1
- package/dist/{p5.Renderer-CwAYZOC2.js → p5.Renderer-Swjl9HQO.js} +5 -5
- package/dist/{rendering--aAe5aq3.js → rendering-B5TRR7aY.js} +101 -66
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +2 -2
- package/dist/shape/index.js +2 -2
- package/dist/type/index.js +3 -3
- package/dist/type/p5.Font.js +3 -5
- package/dist/type/textCore.js +4 -4
- package/dist/webgl/3d_primitives.js +4 -4
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/index.js +4 -4
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +4 -4
- package/dist/webgl/loading.js +4 -4
- package/dist/webgl/material.js +4 -4
- package/dist/webgl/p5.Camera.js +4 -4
- package/dist/webgl/p5.Framebuffer.js +4 -4
- package/dist/webgl/p5.Geometry.js +1 -1
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +4 -4
- package/dist/webgl/p5.Shader.js +4 -4
- package/dist/webgl/p5.Texture.js +4 -4
- package/dist/webgl/text.js +32 -34
- package/lib/p5.esm.js +273 -225
- package/lib/p5.js +273 -225
- package/lib/p5.min.js +1 -1
- package/package.json +1 -2
- package/types/accessibility/color_namer.d.ts +8 -0
- package/types/accessibility/describe.d.ts +184 -0
- package/types/accessibility/gridOutput.d.ts +8 -0
- package/types/accessibility/outputs.d.ts +235 -0
- package/types/accessibility/textOutput.d.ts +8 -0
- package/types/color/color_conversion.d.ts +47 -0
- package/types/color/creating_reading.d.ts +1348 -0
- package/types/color/p5.Color.d.ts +1070 -0
- package/types/color/setting.d.ts +2085 -0
- package/types/core/constants.d.ts +341 -0
- package/types/core/environment.d.ts +668 -0
- package/types/core/friendly_errors/fes_core.d.ts +8 -0
- package/types/core/friendly_errors/file_errors.d.ts +8 -0
- package/types/core/friendly_errors/param_validator.d.ts +30 -0
- package/types/core/friendly_errors/sketch_reader.d.ts +8 -0
- package/types/core/friendly_errors/stacktrace.d.ts +11 -0
- package/types/core/friendly_errors/validate_params.d.ts +8 -0
- package/types/core/helpers.d.ts +8 -0
- package/types/core/legacy.d.ts +8 -0
- package/types/core/main.d.ts +5996 -0
- package/types/core/p5.Graphics.d.ts +484 -0
- package/types/core/p5.Renderer.d.ts +14 -0
- package/types/core/reference.d.ts +8 -0
- package/types/core/rendering.d.ts +481 -0
- package/types/core/structure.d.ts +492 -0
- package/types/core/transform.d.ts +1638 -0
- package/types/data/local_storage.d.ts +323 -0
- package/types/dom/dom.d.ts +1295 -0
- package/types/dom/p5.Element.d.ts +2011 -0
- package/types/dom/p5.File.d.ts +13 -0
- package/types/dom/p5.MediaElement.d.ts +1249 -0
- package/types/events/acceleration.d.ts +193 -0
- package/types/events/keyboard.d.ts +499 -0
- package/types/events/pointer.d.ts +782 -0
- package/types/global.d.ts +5542 -0
- package/types/image/filterRenderer2D.d.ts +54 -0
- package/types/image/image.d.ts +326 -0
- package/types/image/loading_displaying.d.ts +580 -0
- package/types/image/p5.Image.d.ts +5882 -0
- package/types/image/pixels.d.ts +832 -0
- package/types/io/files.d.ts +1447 -0
- package/types/io/p5.Table.d.ts +1247 -0
- package/types/io/p5.TableRow.d.ts +343 -0
- package/types/io/p5.XML.d.ts +1188 -0
- package/types/math/Matrices/Matrix.d.ts +1029 -0
- package/types/math/Matrices/MatrixNumjs.d.ts +8 -0
- package/types/math/calculation.d.ts +923 -0
- package/types/math/math.d.ts +90 -0
- package/types/math/noise.d.ts +311 -0
- package/types/math/p5.Matrix.d.ts +8 -0
- package/types/math/p5.Vector.d.ts +3416 -0
- package/types/math/random.d.ts +267 -0
- package/types/math/trigonometry.d.ts +663 -0
- package/types/p5.d.ts +6663 -0
- package/types/shape/2d_primitives.d.ts +1033 -0
- package/types/shape/attributes.d.ts +466 -0
- package/types/shape/curves.d.ts +740 -0
- package/types/shape/custom_shapes.d.ts +888 -0
- package/types/shape/vertex.d.ts +1141 -0
- package/types/type/p5.Font.d.ts +575 -0
- package/types/type/textCore.d.ts +1198 -0
- package/types/utilities/conversion.d.ts +894 -0
- package/types/utilities/time_date.d.ts +295 -0
- package/types/utilities/utility_functions.d.ts +587 -0
- package/types/webgl/3d_primitives.d.ts +1432 -0
- package/types/webgl/ShaderGenerator.d.ts +8 -0
- package/types/webgl/interaction.d.ts +371 -0
- package/types/webgl/light.d.ts +1184 -0
- package/types/webgl/loading.d.ts +481 -0
- package/types/webgl/material.d.ts +2656 -0
- package/types/webgl/p5.Camera.d.ts +3023 -0
- package/types/webgl/p5.DataArray.d.ts +61 -0
- package/types/webgl/p5.Framebuffer.d.ts +760 -0
- package/types/webgl/p5.Geometry.d.ts +1191 -0
- package/types/webgl/p5.Quat.d.ts +45 -0
- package/types/webgl/p5.RendererGL.d.ts +234 -0
- package/types/webgl/p5.Shader.d.ts +660 -0
- package/types/webgl/p5.Texture.d.ts +61 -0
- package/types/webgl/text.d.ts +74 -0
|
@@ -0,0 +1,1191 @@
|
|
|
1
|
+
// This file is auto-generated from JSDoc documentation
|
|
2
|
+
|
|
3
|
+
import p5 from 'p5';
|
|
4
|
+
import { Color } from '../color/p5.Color';
|
|
5
|
+
import { Vector } from '../math/p5.Vector';
|
|
6
|
+
|
|
7
|
+
declare module 'p5' {
|
|
8
|
+
class Geometry {
|
|
9
|
+
constructor(
|
|
10
|
+
detailX?: number,
|
|
11
|
+
detailY?: number,
|
|
12
|
+
callback?: (this: {
|
|
13
|
+
detailY: number,
|
|
14
|
+
detailX: number,
|
|
15
|
+
vertices: p5.Vector[],
|
|
16
|
+
uvs: number[]
|
|
17
|
+
}) => void);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Calculates the position and size of the smallest box that contains the geometry.A bounding box is the smallest rectangular prism that contains the entire
|
|
21
|
+
* geometry. It's defined by the box's minimum and maximum coordinates along
|
|
22
|
+
* each axis, as well as the size (length) and offset (center).Calling `myGeometry.calculateBoundingBox()` returns an object with four
|
|
23
|
+
* properties that describe the bounding box:`// Get myGeometry's bounding box.
|
|
24
|
+
* let bbox = myGeometry.calculateBoundingBox();
|
|
25
|
+
*
|
|
26
|
+
* // Print the bounding box to the console.
|
|
27
|
+
* console.log(bbox);
|
|
28
|
+
*
|
|
29
|
+
* // {
|
|
30
|
+
* // // The minimum coordinate along each axis.
|
|
31
|
+
* // min: { x: -1, y: -2, z: -3 },
|
|
32
|
+
* //
|
|
33
|
+
* // // The maximum coordinate along each axis.
|
|
34
|
+
* // max: { x: 1, y: 2, z: 3},
|
|
35
|
+
* //
|
|
36
|
+
* // // The size (length) along each axis.
|
|
37
|
+
* // size: { x: 2, y: 4, z: 6},
|
|
38
|
+
* //
|
|
39
|
+
* // // The offset (center) along each axis.
|
|
40
|
+
* // offset: { x: 0, y: 0, z: 0}
|
|
41
|
+
* // }`
|
|
42
|
+
*/
|
|
43
|
+
calculateBoundingBox(): object;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Removes the geometry’s internal colors.`p5.Geometry` objects can be created with "internal colors" assigned to
|
|
47
|
+
* vertices or the entire shape. When a geometry has internal colors,
|
|
48
|
+
* fill() has no effect. Calling
|
|
49
|
+
* `myGeometry.clearColors()` allows the
|
|
50
|
+
* fill() function to apply color to the geometry.
|
|
51
|
+
*/
|
|
52
|
+
clearColors(): void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Flips the geometry’s texture u-coordinates.In order for texture() to work, the geometry
|
|
56
|
+
* needs a way to map the points on its surface to the pixels in a rectangular
|
|
57
|
+
* image that's used as a texture. The geometry's vertex at coordinates
|
|
58
|
+
* `(x, y, z)` maps to the texture image's pixel at coordinates `(u, v)`.The myGeometry.uvs array stores the
|
|
59
|
+
* `(u, v)` coordinates for each vertex in the order it was added to the
|
|
60
|
+
* geometry. Calling `myGeometry.flipU()` flips a geometry's u-coordinates
|
|
61
|
+
* so that the texture appears mirrored horizontally.For example, a plane's four vertices are added clockwise starting from the
|
|
62
|
+
* top-left corner. Here's how calling `myGeometry.flipU()` would change a
|
|
63
|
+
* plane's texture coordinates:`// Print the original texture coordinates.
|
|
64
|
+
* // Output: [0, 0, 1, 0, 0, 1, 1, 1]
|
|
65
|
+
* console.log(myGeometry.uvs);
|
|
66
|
+
*
|
|
67
|
+
* // Flip the u-coordinates.
|
|
68
|
+
* myGeometry.flipU();
|
|
69
|
+
*
|
|
70
|
+
* // Print the flipped texture coordinates.
|
|
71
|
+
* // Output: [1, 0, 0, 0, 1, 1, 0, 1]
|
|
72
|
+
* console.log(myGeometry.uvs);
|
|
73
|
+
*
|
|
74
|
+
* // Notice the swaps:
|
|
75
|
+
* // Top vertices: [0, 0, 1, 0] --> [1, 0, 0, 0]
|
|
76
|
+
* // Bottom vertices: [0, 1, 1, 1] --> [1, 1, 0, 1]`
|
|
77
|
+
*/
|
|
78
|
+
flipU(): void;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Computes the geometry's faces using its vertices.All 3D shapes are made by connecting sets of points called . A
|
|
82
|
+
* geometry's surface is formed by connecting vertices to form triangles that
|
|
83
|
+
* are stitched together. Each triangular patch on the geometry's surface is
|
|
84
|
+
* called a . `myGeometry.computeFaces()` performs the math needed to
|
|
85
|
+
* define each face based on the distances between vertices.The geometry's vertices are stored as p5.Vector
|
|
86
|
+
* objects in the myGeometry.vertices
|
|
87
|
+
* array. The geometry's first vertex is the
|
|
88
|
+
* p5.Vector object at `myGeometry.vertices[0]`,
|
|
89
|
+
* its second vertex is `myGeometry.vertices[1]`, its third vertex is
|
|
90
|
+
* `myGeometry.vertices[2]`, and so on.Calling `myGeometry.computeFaces()` fills the
|
|
91
|
+
* myGeometry.faces array with three-element
|
|
92
|
+
* arrays that list the vertices that form each face. For example, a geometry
|
|
93
|
+
* made from a rectangle has two faces because a rectangle is made by joining
|
|
94
|
+
* two triangles. myGeometry.faces for a
|
|
95
|
+
* rectangle would be the two-dimensional array
|
|
96
|
+
* `[[0, 1, 2], [2, 1, 3]]`. The first face, `myGeometry.faces[0]`, is the
|
|
97
|
+
* array `[0, 1, 2]` because it's formed by connecting
|
|
98
|
+
* `myGeometry.vertices[0]`, `myGeometry.vertices[1]`,and
|
|
99
|
+
* `myGeometry.vertices[2]`. The second face, `myGeometry.faces[1]`, is the
|
|
100
|
+
* array `[2, 1, 3]` because it's formed by connecting
|
|
101
|
+
* `myGeometry.vertices[2]`, `myGeometry.vertices[1]`, and
|
|
102
|
+
* `myGeometry.vertices[3]`.Note: `myGeometry.computeFaces()` only works when geometries have four or more vertices.
|
|
103
|
+
*/
|
|
104
|
+
computeFaces(): void;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Calculates the normal vector for each vertex on the geometry.All 3D shapes are made by connecting sets of points called . A
|
|
108
|
+
* geometry's surface is formed by connecting vertices to create triangles
|
|
109
|
+
* that are stitched together. Each triangular patch on the geometry's
|
|
110
|
+
* surface is called a . `myGeometry.computeNormals()` performs the
|
|
111
|
+
* math needed to orient each face. Orientation is important for lighting
|
|
112
|
+
* and other effects.A face's orientation is defined by its which points out
|
|
113
|
+
* of the face and is normal (perpendicular) to the surface. Calling
|
|
114
|
+
* `myGeometry.computeNormals()` first calculates each face's normal vector.
|
|
115
|
+
* Then it calculates the normal vector for each vertex by averaging the
|
|
116
|
+
* normal vectors of the faces surrounding the vertex. The vertex normals
|
|
117
|
+
* are stored as p5.Vector objects in the
|
|
118
|
+
* myGeometry.vertexNormals array.The first parameter, `shadingType`, is optional. Passing the constant
|
|
119
|
+
* `FLAT`, as in `myGeometry.computeNormals(FLAT)`, provides neighboring
|
|
120
|
+
* faces with their own copies of the vertices they share. Surfaces appear
|
|
121
|
+
* tiled with flat shading. Passing the constant `SMOOTH`, as in
|
|
122
|
+
* `myGeometry.computeNormals(SMOOTH)`, makes neighboring faces reuse their
|
|
123
|
+
* shared vertices. Surfaces appear smoother with smooth shading. By
|
|
124
|
+
* default, `shadingType` is `FLAT`.The second parameter, `options`, is also optional. If an object with a
|
|
125
|
+
* `roundToPrecision` property is passed, as in
|
|
126
|
+
* `myGeometry.computeNormals(SMOOTH, { roundToPrecision: 5 })`, it sets the
|
|
127
|
+
* number of decimal places to use for calculations. By default,
|
|
128
|
+
* `roundToPrecision` uses 3 decimal places.
|
|
129
|
+
*
|
|
130
|
+
* @param
|
|
131
|
+
* @param
|
|
132
|
+
*/
|
|
133
|
+
computeNormals(shadingType: FLAT | SMOOTH, options: object): void;
|
|
134
|
+
|
|
135
|
+
makeEdgesFromFaces(): void;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Transforms the geometry's vertices to fit snugly within a 100×100×100 box
|
|
139
|
+
* centered at the origin.Calling `myGeometry.normalize()` translates the geometry's vertices so that
|
|
140
|
+
* they're centered at the origin `(0, 0, 0)`. Then it scales the vertices so
|
|
141
|
+
* that they fill a 100×100×100 box. As a result, small geometries will grow
|
|
142
|
+
* and large geometries will shrink.Note: `myGeometry.normalize()` only works when called in the
|
|
143
|
+
* setup() function.
|
|
144
|
+
*/
|
|
145
|
+
normalize(): void;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Sets the shader's vertex property or attribute variables.A vertex property, or vertex attribute, is a variable belonging to a vertex in a shader. p5.js provides some
|
|
149
|
+
* default properties, such as `aPosition`, `aNormal`, `aVertexColor`, etc. These are
|
|
150
|
+
* set using vertex(), normal()
|
|
151
|
+
* and fill() respectively. Custom properties can also
|
|
152
|
+
* be defined within beginShape() and
|
|
153
|
+
* endShape().The first parameter, `propertyName`, is a string with the property's name.
|
|
154
|
+
* This is the same variable name which should be declared in the shader, as in
|
|
155
|
+
* `in vec3 aProperty`, similar to .`setUniform()`.The second parameter, `data`, is the value assigned to the shader variable. This value
|
|
156
|
+
* will be pushed directly onto the Geometry object. There should be the same number
|
|
157
|
+
* of custom property values as vertices, this method should be invoked once for each
|
|
158
|
+
* vertex.The `data` can be a Number or an array of numbers. Tn the shader program the type
|
|
159
|
+
* can be declared according to the WebGL specification. Common types include `float`,
|
|
160
|
+
* `vec2`, `vec3`, `vec4` or matrices.See also the global vertexProperty() function.
|
|
161
|
+
*
|
|
162
|
+
* @param
|
|
163
|
+
* @param
|
|
164
|
+
* @param
|
|
165
|
+
*/
|
|
166
|
+
vertexProperty(propertyName: string, data: number | number[], size: number): void;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Flips the geometry’s texture v-coordinates.In order for texture() to work, the geometry
|
|
170
|
+
* needs a way to map the points on its surface to the pixels in a rectangular
|
|
171
|
+
* image that's used as a texture. The geometry's vertex at coordinates
|
|
172
|
+
* `(x, y, z)` maps to the texture image's pixel at coordinates `(u, v)`.The myGeometry.uvs array stores the
|
|
173
|
+
* `(u, v)` coordinates for each vertex in the order it was added to the
|
|
174
|
+
* geometry. Calling `myGeometry.flipV()` flips a geometry's v-coordinates
|
|
175
|
+
* so that the texture appears mirrored vertically.For example, a plane's four vertices are added clockwise starting from the
|
|
176
|
+
* top-left corner. Here's how calling `myGeometry.flipV()` would change a
|
|
177
|
+
* plane's texture coordinates:`// Print the original texture coordinates.
|
|
178
|
+
* // Output: [0, 0, 1, 0, 0, 1, 1, 1]
|
|
179
|
+
* console.log(myGeometry.uvs);
|
|
180
|
+
*
|
|
181
|
+
* // Flip the v-coordinates.
|
|
182
|
+
* myGeometry.flipV();
|
|
183
|
+
*
|
|
184
|
+
* // Print the flipped texture coordinates.
|
|
185
|
+
* // Output: [0, 1, 1, 1, 0, 0, 1, 0]
|
|
186
|
+
* console.log(myGeometry.uvs);
|
|
187
|
+
*
|
|
188
|
+
* // Notice the swaps:
|
|
189
|
+
* // Left vertices: [0, 0] <--> [1, 0]
|
|
190
|
+
* // Right vertices: [1, 0] <--> [1, 1]`
|
|
191
|
+
*/
|
|
192
|
+
flipV(): void;
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Calculates the position and size of the smallest box that contains the geometry.A bounding box is the smallest rectangular prism that contains the entire
|
|
198
|
+
* geometry. It's defined by the box's minimum and maximum coordinates along
|
|
199
|
+
* each axis, as well as the size (length) and offset (center).Calling `myGeometry.calculateBoundingBox()` returns an object with four
|
|
200
|
+
* properties that describe the bounding box:`// Get myGeometry's bounding box.
|
|
201
|
+
* let bbox = myGeometry.calculateBoundingBox();
|
|
202
|
+
*
|
|
203
|
+
* // Print the bounding box to the console.
|
|
204
|
+
* console.log(bbox);
|
|
205
|
+
*
|
|
206
|
+
* // {
|
|
207
|
+
* // // The minimum coordinate along each axis.
|
|
208
|
+
* // min: { x: -1, y: -2, z: -3 },
|
|
209
|
+
* //
|
|
210
|
+
* // // The maximum coordinate along each axis.
|
|
211
|
+
* // max: { x: 1, y: 2, z: 3},
|
|
212
|
+
* //
|
|
213
|
+
* // // The size (length) along each axis.
|
|
214
|
+
* // size: { x: 2, y: 4, z: 6},
|
|
215
|
+
* //
|
|
216
|
+
* // // The offset (center) along each axis.
|
|
217
|
+
* // offset: { x: 0, y: 0, z: 0}
|
|
218
|
+
* // }`
|
|
219
|
+
*
|
|
220
|
+
* @returns bounding box of the geometry.
|
|
221
|
+
* @example <div>
|
|
222
|
+
* <code>
|
|
223
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
224
|
+
*
|
|
225
|
+
* let particles;
|
|
226
|
+
*
|
|
227
|
+
* function setup() {
|
|
228
|
+
* createCanvas(100, 100, WEBGL);
|
|
229
|
+
*
|
|
230
|
+
* // Create a new p5.Geometry object with random spheres.
|
|
231
|
+
* particles = buildGeometry(createParticles);
|
|
232
|
+
*
|
|
233
|
+
* describe('Ten white spheres placed randomly against a gray background. A box encloses the spheres.');
|
|
234
|
+
* }
|
|
235
|
+
*
|
|
236
|
+
* function draw() {
|
|
237
|
+
* background(50);
|
|
238
|
+
*
|
|
239
|
+
* // Enable orbiting with the mouse.
|
|
240
|
+
* orbitControl();
|
|
241
|
+
*
|
|
242
|
+
* // Turn on the lights.
|
|
243
|
+
* lights();
|
|
244
|
+
*
|
|
245
|
+
* // Style the particles.
|
|
246
|
+
* noStroke();
|
|
247
|
+
* fill(255);
|
|
248
|
+
*
|
|
249
|
+
* // Draw the particles.
|
|
250
|
+
* model(particles);
|
|
251
|
+
*
|
|
252
|
+
* // Calculate the bounding box.
|
|
253
|
+
* let bbox = particles.calculateBoundingBox();
|
|
254
|
+
*
|
|
255
|
+
* // Translate to the bounding box's center.
|
|
256
|
+
* translate(bbox.offset.x, bbox.offset.y, bbox.offset.z);
|
|
257
|
+
*
|
|
258
|
+
* // Style the bounding box.
|
|
259
|
+
* stroke(255);
|
|
260
|
+
* noFill();
|
|
261
|
+
*
|
|
262
|
+
* // Draw the bounding box.
|
|
263
|
+
* box(bbox.size.x, bbox.size.y, bbox.size.z);
|
|
264
|
+
* }
|
|
265
|
+
*
|
|
266
|
+
* function createParticles() {
|
|
267
|
+
* for (let i = 0; i < 10; i += 1) {
|
|
268
|
+
* // Calculate random coordinates.
|
|
269
|
+
* let x = randomGaussian(0, 15);
|
|
270
|
+
* let y = randomGaussian(0, 15);
|
|
271
|
+
* let z = randomGaussian(0, 15);
|
|
272
|
+
*
|
|
273
|
+
* push();
|
|
274
|
+
* // Translate to the particle's coordinates.
|
|
275
|
+
* translate(x, y, z);
|
|
276
|
+
* // Draw the particle.
|
|
277
|
+
* sphere(3);
|
|
278
|
+
* pop();
|
|
279
|
+
* }
|
|
280
|
+
* }
|
|
281
|
+
* </code>
|
|
282
|
+
* </div>
|
|
283
|
+
*/
|
|
284
|
+
function calculateBoundingBox(): object;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Removes the geometry’s internal colors.`p5.Geometry` objects can be created with "internal colors" assigned to
|
|
288
|
+
* vertices or the entire shape. When a geometry has internal colors,
|
|
289
|
+
* fill() has no effect. Calling
|
|
290
|
+
* `myGeometry.clearColors()` allows the
|
|
291
|
+
* fill() function to apply color to the geometry.
|
|
292
|
+
*
|
|
293
|
+
* @example <div>
|
|
294
|
+
* <code>
|
|
295
|
+
* function setup() {
|
|
296
|
+
* createCanvas(100, 100, WEBGL);
|
|
297
|
+
*
|
|
298
|
+
* background(200);
|
|
299
|
+
*
|
|
300
|
+
* // Create a p5.Geometry object.
|
|
301
|
+
* // Set its internal color to red.
|
|
302
|
+
* let myGeometry = buildGeometry(function() {
|
|
303
|
+
* fill(255, 0, 0);
|
|
304
|
+
* plane(20);
|
|
305
|
+
* });
|
|
306
|
+
*
|
|
307
|
+
* // Style the shape.
|
|
308
|
+
* noStroke();
|
|
309
|
+
*
|
|
310
|
+
* // Draw the p5.Geometry object (center).
|
|
311
|
+
* model(myGeometry);
|
|
312
|
+
*
|
|
313
|
+
* // Translate the origin to the bottom-right.
|
|
314
|
+
* translate(25, 25, 0);
|
|
315
|
+
*
|
|
316
|
+
* // Try to fill the geometry with green.
|
|
317
|
+
* fill(0, 255, 0);
|
|
318
|
+
*
|
|
319
|
+
* // Draw the geometry again (bottom-right).
|
|
320
|
+
* model(myGeometry);
|
|
321
|
+
*
|
|
322
|
+
* // Clear the geometry's colors.
|
|
323
|
+
* myGeometry.clearColors();
|
|
324
|
+
*
|
|
325
|
+
* // Fill the geometry with blue.
|
|
326
|
+
* fill(0, 0, 255);
|
|
327
|
+
*
|
|
328
|
+
* // Translate the origin up.
|
|
329
|
+
* translate(0, -50, 0);
|
|
330
|
+
*
|
|
331
|
+
* // Draw the geometry again (top-right).
|
|
332
|
+
* model(myGeometry);
|
|
333
|
+
*
|
|
334
|
+
* describe(
|
|
335
|
+
* 'Three squares drawn against a gray background. Red squares are at the center and the bottom-right. A blue square is at the top-right.'
|
|
336
|
+
* );
|
|
337
|
+
* }
|
|
338
|
+
* </code>
|
|
339
|
+
* </div>
|
|
340
|
+
*/
|
|
341
|
+
function clearColors(): void;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Flips the geometry’s texture u-coordinates.In order for texture() to work, the geometry
|
|
345
|
+
* needs a way to map the points on its surface to the pixels in a rectangular
|
|
346
|
+
* image that's used as a texture. The geometry's vertex at coordinates
|
|
347
|
+
* `(x, y, z)` maps to the texture image's pixel at coordinates `(u, v)`.The myGeometry.uvs array stores the
|
|
348
|
+
* `(u, v)` coordinates for each vertex in the order it was added to the
|
|
349
|
+
* geometry. Calling `myGeometry.flipU()` flips a geometry's u-coordinates
|
|
350
|
+
* so that the texture appears mirrored horizontally.For example, a plane's four vertices are added clockwise starting from the
|
|
351
|
+
* top-left corner. Here's how calling `myGeometry.flipU()` would change a
|
|
352
|
+
* plane's texture coordinates:`// Print the original texture coordinates.
|
|
353
|
+
* // Output: [0, 0, 1, 0, 0, 1, 1, 1]
|
|
354
|
+
* console.log(myGeometry.uvs);
|
|
355
|
+
*
|
|
356
|
+
* // Flip the u-coordinates.
|
|
357
|
+
* myGeometry.flipU();
|
|
358
|
+
*
|
|
359
|
+
* // Print the flipped texture coordinates.
|
|
360
|
+
* // Output: [1, 0, 0, 0, 1, 1, 0, 1]
|
|
361
|
+
* console.log(myGeometry.uvs);
|
|
362
|
+
*
|
|
363
|
+
* // Notice the swaps:
|
|
364
|
+
* // Top vertices: [0, 0, 1, 0] --> [1, 0, 0, 0]
|
|
365
|
+
* // Bottom vertices: [0, 1, 1, 1] --> [1, 1, 0, 1]`
|
|
366
|
+
*
|
|
367
|
+
* @for p5.Geometry
|
|
368
|
+
* @example <div>
|
|
369
|
+
* <code>
|
|
370
|
+
* let img;
|
|
371
|
+
*
|
|
372
|
+
* async function setup() {
|
|
373
|
+
* img = await loadImage('assets/laDefense.jpg');
|
|
374
|
+
* createCanvas(100, 100, WEBGL);
|
|
375
|
+
*
|
|
376
|
+
* background(200);
|
|
377
|
+
*
|
|
378
|
+
* // Create p5.Geometry objects.
|
|
379
|
+
* let geom1 = buildGeometry(createShape);
|
|
380
|
+
* let geom2 = buildGeometry(createShape);
|
|
381
|
+
*
|
|
382
|
+
* // Flip geom2's U texture coordinates.
|
|
383
|
+
* geom2.flipU();
|
|
384
|
+
*
|
|
385
|
+
* // Left (original).
|
|
386
|
+
* push();
|
|
387
|
+
* translate(-25, 0, 0);
|
|
388
|
+
* texture(img);
|
|
389
|
+
* noStroke();
|
|
390
|
+
* model(geom1);
|
|
391
|
+
* pop();
|
|
392
|
+
*
|
|
393
|
+
* // Right (flipped).
|
|
394
|
+
* push();
|
|
395
|
+
* translate(25, 0, 0);
|
|
396
|
+
* texture(img);
|
|
397
|
+
* noStroke();
|
|
398
|
+
* model(geom2);
|
|
399
|
+
* pop();
|
|
400
|
+
*
|
|
401
|
+
* describe(
|
|
402
|
+
* 'Two photos of a ceiling on a gray background. The photos are mirror images of each other.'
|
|
403
|
+
* );
|
|
404
|
+
* }
|
|
405
|
+
*
|
|
406
|
+
* function createShape() {
|
|
407
|
+
* plane(40);
|
|
408
|
+
* }
|
|
409
|
+
* </code>
|
|
410
|
+
* </div>
|
|
411
|
+
*/
|
|
412
|
+
function flipU(): void;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Computes the geometry's faces using its vertices.All 3D shapes are made by connecting sets of points called . A
|
|
416
|
+
* geometry's surface is formed by connecting vertices to form triangles that
|
|
417
|
+
* are stitched together. Each triangular patch on the geometry's surface is
|
|
418
|
+
* called a . `myGeometry.computeFaces()` performs the math needed to
|
|
419
|
+
* define each face based on the distances between vertices.The geometry's vertices are stored as p5.Vector
|
|
420
|
+
* objects in the myGeometry.vertices
|
|
421
|
+
* array. The geometry's first vertex is the
|
|
422
|
+
* p5.Vector object at `myGeometry.vertices[0]`,
|
|
423
|
+
* its second vertex is `myGeometry.vertices[1]`, its third vertex is
|
|
424
|
+
* `myGeometry.vertices[2]`, and so on.Calling `myGeometry.computeFaces()` fills the
|
|
425
|
+
* myGeometry.faces array with three-element
|
|
426
|
+
* arrays that list the vertices that form each face. For example, a geometry
|
|
427
|
+
* made from a rectangle has two faces because a rectangle is made by joining
|
|
428
|
+
* two triangles. myGeometry.faces for a
|
|
429
|
+
* rectangle would be the two-dimensional array
|
|
430
|
+
* `[[0, 1, 2], [2, 1, 3]]`. The first face, `myGeometry.faces[0]`, is the
|
|
431
|
+
* array `[0, 1, 2]` because it's formed by connecting
|
|
432
|
+
* `myGeometry.vertices[0]`, `myGeometry.vertices[1]`,and
|
|
433
|
+
* `myGeometry.vertices[2]`. The second face, `myGeometry.faces[1]`, is the
|
|
434
|
+
* array `[2, 1, 3]` because it's formed by connecting
|
|
435
|
+
* `myGeometry.vertices[2]`, `myGeometry.vertices[1]`, and
|
|
436
|
+
* `myGeometry.vertices[3]`.Note: `myGeometry.computeFaces()` only works when geometries have four or more vertices.
|
|
437
|
+
*
|
|
438
|
+
* @example <div>
|
|
439
|
+
* <code>
|
|
440
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
441
|
+
*
|
|
442
|
+
* let myGeometry;
|
|
443
|
+
*
|
|
444
|
+
* function setup() {
|
|
445
|
+
* createCanvas(100, 100, WEBGL);
|
|
446
|
+
*
|
|
447
|
+
* // Create a p5.Geometry object.
|
|
448
|
+
* myGeometry = new p5.Geometry();
|
|
449
|
+
*
|
|
450
|
+
* // Create p5.Vector objects to position the vertices.
|
|
451
|
+
* let v0 = createVector(-40, 0, 0);
|
|
452
|
+
* let v1 = createVector(0, -40, 0);
|
|
453
|
+
* let v2 = createVector(0, 40, 0);
|
|
454
|
+
* let v3 = createVector(40, 0, 0);
|
|
455
|
+
*
|
|
456
|
+
* // Add the vertices to myGeometry's vertices array.
|
|
457
|
+
* myGeometry.vertices.push(v0, v1, v2, v3);
|
|
458
|
+
*
|
|
459
|
+
* // Compute myGeometry's faces array.
|
|
460
|
+
* myGeometry.computeFaces();
|
|
461
|
+
*
|
|
462
|
+
* describe('A red square drawn on a gray background.');
|
|
463
|
+
* }
|
|
464
|
+
*
|
|
465
|
+
* function draw() {
|
|
466
|
+
* background(200);
|
|
467
|
+
*
|
|
468
|
+
* // Enable orbiting with the mouse.
|
|
469
|
+
* orbitControl();
|
|
470
|
+
*
|
|
471
|
+
* // Turn on the lights.
|
|
472
|
+
* lights();
|
|
473
|
+
*
|
|
474
|
+
* // Style the shape.
|
|
475
|
+
* noStroke();
|
|
476
|
+
* fill(255, 0, 0);
|
|
477
|
+
*
|
|
478
|
+
* // Draw the p5.Geometry object.
|
|
479
|
+
* model(myGeometry);
|
|
480
|
+
* }
|
|
481
|
+
* </code>
|
|
482
|
+
* </div>
|
|
483
|
+
*
|
|
484
|
+
* <div>
|
|
485
|
+
* <code>
|
|
486
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
487
|
+
*
|
|
488
|
+
* let myGeometry;
|
|
489
|
+
*
|
|
490
|
+
* function setup() {
|
|
491
|
+
* createCanvas(100, 100, WEBGL);
|
|
492
|
+
*
|
|
493
|
+
* // Create a p5.Geometry object using a callback function.
|
|
494
|
+
* myGeometry = new p5.Geometry(1, 1, createShape);
|
|
495
|
+
*
|
|
496
|
+
* describe('A red square drawn on a gray background.');
|
|
497
|
+
* }
|
|
498
|
+
*
|
|
499
|
+
* function draw() {
|
|
500
|
+
* background(200);
|
|
501
|
+
*
|
|
502
|
+
* // Enable orbiting with the mouse.
|
|
503
|
+
* orbitControl();
|
|
504
|
+
*
|
|
505
|
+
* // Turn on the lights.
|
|
506
|
+
* lights();
|
|
507
|
+
*
|
|
508
|
+
* // Style the shape.
|
|
509
|
+
* noStroke();
|
|
510
|
+
* fill(255, 0, 0);
|
|
511
|
+
*
|
|
512
|
+
* // Draw the p5.Geometry object.
|
|
513
|
+
* model(myGeometry);
|
|
514
|
+
* }
|
|
515
|
+
*
|
|
516
|
+
* function createShape() {
|
|
517
|
+
* // Create p5.Vector objects to position the vertices.
|
|
518
|
+
* let v0 = createVector(-40, 0, 0);
|
|
519
|
+
* let v1 = createVector(0, -40, 0);
|
|
520
|
+
* let v2 = createVector(0, 40, 0);
|
|
521
|
+
* let v3 = createVector(40, 0, 0);
|
|
522
|
+
*
|
|
523
|
+
* // Add the vertices to the p5.Geometry object's vertices array.
|
|
524
|
+
* this.vertices.push(v0, v1, v2, v3);
|
|
525
|
+
*
|
|
526
|
+
* // Compute the faces array.
|
|
527
|
+
* this.computeFaces();
|
|
528
|
+
* }
|
|
529
|
+
* </code>
|
|
530
|
+
* </div>
|
|
531
|
+
*/
|
|
532
|
+
function computeFaces(): void;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Calculates the normal vector for each vertex on the geometry.All 3D shapes are made by connecting sets of points called . A
|
|
536
|
+
* geometry's surface is formed by connecting vertices to create triangles
|
|
537
|
+
* that are stitched together. Each triangular patch on the geometry's
|
|
538
|
+
* surface is called a . `myGeometry.computeNormals()` performs the
|
|
539
|
+
* math needed to orient each face. Orientation is important for lighting
|
|
540
|
+
* and other effects.A face's orientation is defined by its which points out
|
|
541
|
+
* of the face and is normal (perpendicular) to the surface. Calling
|
|
542
|
+
* `myGeometry.computeNormals()` first calculates each face's normal vector.
|
|
543
|
+
* Then it calculates the normal vector for each vertex by averaging the
|
|
544
|
+
* normal vectors of the faces surrounding the vertex. The vertex normals
|
|
545
|
+
* are stored as p5.Vector objects in the
|
|
546
|
+
* myGeometry.vertexNormals array.The first parameter, `shadingType`, is optional. Passing the constant
|
|
547
|
+
* `FLAT`, as in `myGeometry.computeNormals(FLAT)`, provides neighboring
|
|
548
|
+
* faces with their own copies of the vertices they share. Surfaces appear
|
|
549
|
+
* tiled with flat shading. Passing the constant `SMOOTH`, as in
|
|
550
|
+
* `myGeometry.computeNormals(SMOOTH)`, makes neighboring faces reuse their
|
|
551
|
+
* shared vertices. Surfaces appear smoother with smooth shading. By
|
|
552
|
+
* default, `shadingType` is `FLAT`.The second parameter, `options`, is also optional. If an object with a
|
|
553
|
+
* `roundToPrecision` property is passed, as in
|
|
554
|
+
* `myGeometry.computeNormals(SMOOTH, { roundToPrecision: 5 })`, it sets the
|
|
555
|
+
* number of decimal places to use for calculations. By default,
|
|
556
|
+
* `roundToPrecision` uses 3 decimal places.
|
|
557
|
+
*
|
|
558
|
+
* @param shading type. either FLAT or SMOOTH. Defaults to `FLAT`.
|
|
559
|
+
* @param shading options.
|
|
560
|
+
* @example <div>
|
|
561
|
+
* <code>
|
|
562
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
563
|
+
*
|
|
564
|
+
* let myGeometry;
|
|
565
|
+
*
|
|
566
|
+
* function setup() {
|
|
567
|
+
* createCanvas(100, 100, WEBGL);
|
|
568
|
+
*
|
|
569
|
+
* // Create a p5.Geometry object.
|
|
570
|
+
* myGeometry = buildGeometry(function() {
|
|
571
|
+
* torus();
|
|
572
|
+
* });
|
|
573
|
+
*
|
|
574
|
+
* // Compute the vertex normals.
|
|
575
|
+
* myGeometry.computeNormals();
|
|
576
|
+
*
|
|
577
|
+
* describe(
|
|
578
|
+
* "A white torus drawn on a dark gray background. Red lines extend outward from the torus' vertices."
|
|
579
|
+
* );
|
|
580
|
+
* }
|
|
581
|
+
*
|
|
582
|
+
* function draw() {
|
|
583
|
+
* background(50);
|
|
584
|
+
*
|
|
585
|
+
* // Enable orbiting with the mouse.
|
|
586
|
+
* orbitControl();
|
|
587
|
+
*
|
|
588
|
+
* // Turn on the lights.
|
|
589
|
+
* lights();
|
|
590
|
+
*
|
|
591
|
+
* // Rotate the coordinate system.
|
|
592
|
+
* rotateX(1);
|
|
593
|
+
*
|
|
594
|
+
* // Style the helix.
|
|
595
|
+
* stroke(0);
|
|
596
|
+
*
|
|
597
|
+
* // Display the helix.
|
|
598
|
+
* model(myGeometry);
|
|
599
|
+
*
|
|
600
|
+
* // Style the normal vectors.
|
|
601
|
+
* stroke(255, 0, 0);
|
|
602
|
+
*
|
|
603
|
+
* // Iterate over the vertices and vertexNormals arrays.
|
|
604
|
+
* for (let i = 0; i < myGeometry.vertices.length; i += 1) {
|
|
605
|
+
*
|
|
606
|
+
* // Get the vertex p5.Vector object.
|
|
607
|
+
* let v = myGeometry.vertices[i];
|
|
608
|
+
*
|
|
609
|
+
* // Get the vertex normal p5.Vector object.
|
|
610
|
+
* let n = myGeometry.vertexNormals[i];
|
|
611
|
+
*
|
|
612
|
+
* // Calculate a point along the vertex normal.
|
|
613
|
+
* let p = p5.Vector.mult(n, 5);
|
|
614
|
+
*
|
|
615
|
+
* // Draw the vertex normal as a red line.
|
|
616
|
+
* push();
|
|
617
|
+
* translate(v);
|
|
618
|
+
* line(0, 0, 0, p.x, p.y, p.z);
|
|
619
|
+
* pop();
|
|
620
|
+
* }
|
|
621
|
+
* }
|
|
622
|
+
* </code>
|
|
623
|
+
* </div>
|
|
624
|
+
*
|
|
625
|
+
* <div>
|
|
626
|
+
* <code>
|
|
627
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
628
|
+
*
|
|
629
|
+
* let myGeometry;
|
|
630
|
+
*
|
|
631
|
+
* function setup() {
|
|
632
|
+
* createCanvas(100, 100, WEBGL);
|
|
633
|
+
*
|
|
634
|
+
* // Create a p5.Geometry object using a callback function.
|
|
635
|
+
* myGeometry = new p5.Geometry();
|
|
636
|
+
*
|
|
637
|
+
* // Create p5.Vector objects to position the vertices.
|
|
638
|
+
* let v0 = createVector(-40, 0, 0);
|
|
639
|
+
* let v1 = createVector(0, -40, 0);
|
|
640
|
+
* let v2 = createVector(0, 40, 0);
|
|
641
|
+
* let v3 = createVector(40, 0, 0);
|
|
642
|
+
*
|
|
643
|
+
* // Add the vertices to the p5.Geometry object's vertices array.
|
|
644
|
+
* myGeometry.vertices.push(v0, v1, v2, v3);
|
|
645
|
+
*
|
|
646
|
+
* // Compute the faces array.
|
|
647
|
+
* myGeometry.computeFaces();
|
|
648
|
+
*
|
|
649
|
+
* // Compute the surface normals.
|
|
650
|
+
* myGeometry.computeNormals();
|
|
651
|
+
*
|
|
652
|
+
* describe('A red square drawn on a gray background.');
|
|
653
|
+
* }
|
|
654
|
+
*
|
|
655
|
+
* function draw() {
|
|
656
|
+
* background(200);
|
|
657
|
+
*
|
|
658
|
+
* // Enable orbiting with the mouse.
|
|
659
|
+
* orbitControl();
|
|
660
|
+
*
|
|
661
|
+
* // Add a white point light.
|
|
662
|
+
* pointLight(255, 255, 255, 0, 0, 10);
|
|
663
|
+
*
|
|
664
|
+
* // Style the p5.Geometry object.
|
|
665
|
+
* noStroke();
|
|
666
|
+
* fill(255, 0, 0);
|
|
667
|
+
*
|
|
668
|
+
* // Draw the p5.Geometry object.
|
|
669
|
+
* model(myGeometry);
|
|
670
|
+
* }
|
|
671
|
+
* </code>
|
|
672
|
+
* </div>
|
|
673
|
+
*
|
|
674
|
+
* <div>
|
|
675
|
+
* <code>
|
|
676
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
677
|
+
*
|
|
678
|
+
* let myGeometry;
|
|
679
|
+
*
|
|
680
|
+
* function setup() {
|
|
681
|
+
* createCanvas(100, 100, WEBGL);
|
|
682
|
+
*
|
|
683
|
+
* // Create a p5.Geometry object.
|
|
684
|
+
* myGeometry = buildGeometry(createShape);
|
|
685
|
+
*
|
|
686
|
+
* // Compute normals using default (FLAT) shading.
|
|
687
|
+
* myGeometry.computeNormals(FLAT);
|
|
688
|
+
*
|
|
689
|
+
* describe('A white, helical structure drawn on a dark gray background. Its faces appear faceted.');
|
|
690
|
+
* }
|
|
691
|
+
*
|
|
692
|
+
* function draw() {
|
|
693
|
+
* background(50);
|
|
694
|
+
*
|
|
695
|
+
* // Enable orbiting with the mouse.
|
|
696
|
+
* orbitControl();
|
|
697
|
+
*
|
|
698
|
+
* // Turn on the lights.
|
|
699
|
+
* lights();
|
|
700
|
+
*
|
|
701
|
+
* // Rotate the coordinate system.
|
|
702
|
+
* rotateX(1);
|
|
703
|
+
*
|
|
704
|
+
* // Style the helix.
|
|
705
|
+
* noStroke();
|
|
706
|
+
*
|
|
707
|
+
* // Display the helix.
|
|
708
|
+
* model(myGeometry);
|
|
709
|
+
* }
|
|
710
|
+
*
|
|
711
|
+
* function createShape() {
|
|
712
|
+
* // Create a helical shape.
|
|
713
|
+
* beginShape();
|
|
714
|
+
* for (let i = 0; i < TWO_PI * 3; i += 0.5) {
|
|
715
|
+
* let x = 30 * cos(i);
|
|
716
|
+
* let y = 30 * sin(i);
|
|
717
|
+
* let z = map(i, 0, TWO_PI * 3, -40, 40);
|
|
718
|
+
* vertex(x, y, z);
|
|
719
|
+
* }
|
|
720
|
+
* endShape();
|
|
721
|
+
* }
|
|
722
|
+
* </code>
|
|
723
|
+
* </div>
|
|
724
|
+
*
|
|
725
|
+
* <div>
|
|
726
|
+
* <code>
|
|
727
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
728
|
+
*
|
|
729
|
+
* let myGeometry;
|
|
730
|
+
*
|
|
731
|
+
* function setup() {
|
|
732
|
+
* createCanvas(100, 100, WEBGL);
|
|
733
|
+
*
|
|
734
|
+
* // Create a p5.Geometry object.
|
|
735
|
+
* myGeometry = buildGeometry(createShape);
|
|
736
|
+
*
|
|
737
|
+
* // Compute normals using smooth shading.
|
|
738
|
+
* myGeometry.computeNormals(SMOOTH);
|
|
739
|
+
*
|
|
740
|
+
* describe('A white, helical structure drawn on a dark gray background.');
|
|
741
|
+
* }
|
|
742
|
+
*
|
|
743
|
+
* function draw() {
|
|
744
|
+
* background(50);
|
|
745
|
+
*
|
|
746
|
+
* // Enable orbiting with the mouse.
|
|
747
|
+
* orbitControl();
|
|
748
|
+
*
|
|
749
|
+
* // Turn on the lights.
|
|
750
|
+
* lights();
|
|
751
|
+
*
|
|
752
|
+
* // Rotate the coordinate system.
|
|
753
|
+
* rotateX(1);
|
|
754
|
+
*
|
|
755
|
+
* // Style the helix.
|
|
756
|
+
* noStroke();
|
|
757
|
+
*
|
|
758
|
+
* // Display the helix.
|
|
759
|
+
* model(myGeometry);
|
|
760
|
+
* }
|
|
761
|
+
*
|
|
762
|
+
* function createShape() {
|
|
763
|
+
* // Create a helical shape.
|
|
764
|
+
* beginShape();
|
|
765
|
+
* for (let i = 0; i < TWO_PI * 3; i += 0.5) {
|
|
766
|
+
* let x = 30 * cos(i);
|
|
767
|
+
* let y = 30 * sin(i);
|
|
768
|
+
* let z = map(i, 0, TWO_PI * 3, -40, 40);
|
|
769
|
+
* vertex(x, y, z);
|
|
770
|
+
* }
|
|
771
|
+
* endShape();
|
|
772
|
+
* }
|
|
773
|
+
* </code>
|
|
774
|
+
* </div>
|
|
775
|
+
*
|
|
776
|
+
* <div>
|
|
777
|
+
* <code>
|
|
778
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
779
|
+
*
|
|
780
|
+
* let myGeometry;
|
|
781
|
+
*
|
|
782
|
+
* function setup() {
|
|
783
|
+
* createCanvas(100, 100, WEBGL);
|
|
784
|
+
*
|
|
785
|
+
* // Create a p5.Geometry object.
|
|
786
|
+
* myGeometry = buildGeometry(createShape);
|
|
787
|
+
*
|
|
788
|
+
* // Create an options object.
|
|
789
|
+
* let options = { roundToPrecision: 5 };
|
|
790
|
+
*
|
|
791
|
+
* // Compute normals using smooth shading.
|
|
792
|
+
* myGeometry.computeNormals(SMOOTH, options);
|
|
793
|
+
*
|
|
794
|
+
* describe('A white, helical structure drawn on a dark gray background.');
|
|
795
|
+
* }
|
|
796
|
+
*
|
|
797
|
+
* function draw() {
|
|
798
|
+
* background(50);
|
|
799
|
+
*
|
|
800
|
+
* // Enable orbiting with the mouse.
|
|
801
|
+
* orbitControl();
|
|
802
|
+
*
|
|
803
|
+
* // Turn on the lights.
|
|
804
|
+
* lights();
|
|
805
|
+
*
|
|
806
|
+
* // Rotate the coordinate system.
|
|
807
|
+
* rotateX(1);
|
|
808
|
+
*
|
|
809
|
+
* // Style the helix.
|
|
810
|
+
* noStroke();
|
|
811
|
+
*
|
|
812
|
+
* // Display the helix.
|
|
813
|
+
* model(myGeometry);
|
|
814
|
+
* }
|
|
815
|
+
*
|
|
816
|
+
* function createShape() {
|
|
817
|
+
* // Create a helical shape.
|
|
818
|
+
* beginShape();
|
|
819
|
+
* for (let i = 0; i < TWO_PI * 3; i += 0.5) {
|
|
820
|
+
* let x = 30 * cos(i);
|
|
821
|
+
* let y = 30 * sin(i);
|
|
822
|
+
* let z = map(i, 0, TWO_PI * 3, -40, 40);
|
|
823
|
+
* vertex(x, y, z);
|
|
824
|
+
* }
|
|
825
|
+
* endShape();
|
|
826
|
+
* }
|
|
827
|
+
* </code>
|
|
828
|
+
* </div>
|
|
829
|
+
*/
|
|
830
|
+
function computeNormals(shadingType: FLAT | SMOOTH, options?: object): void;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* @example <div>
|
|
834
|
+
* <code>
|
|
835
|
+
* let tetrahedron;
|
|
836
|
+
* function setup() {
|
|
837
|
+
* createCanvas(200, 200, WEBGL);
|
|
838
|
+
* describe('A rotating tetrahedron');
|
|
839
|
+
*
|
|
840
|
+
* tetrahedron = new p5.Geometry();
|
|
841
|
+
*
|
|
842
|
+
* // Give each geometry a unique gid
|
|
843
|
+
* tetrahedron.gid = 'tetrahedron';
|
|
844
|
+
*
|
|
845
|
+
* // Add four points of the tetrahedron
|
|
846
|
+
*
|
|
847
|
+
* let radius = 50;
|
|
848
|
+
* // A 2D triangle:
|
|
849
|
+
* tetrahedron.vertices.push(createVector(radius, 0, 0));
|
|
850
|
+
* tetrahedron.vertices.push(createVector(radius, 0, 0).rotate(TWO_PI / 3));
|
|
851
|
+
* tetrahedron.vertices.push(createVector(radius, 0, 0).rotate(TWO_PI * 2 / 3));
|
|
852
|
+
* // Add a tip in the z axis:
|
|
853
|
+
* tetrahedron.vertices.push(createVector(0, 0, radius));
|
|
854
|
+
*
|
|
855
|
+
* // Create the four faces by connecting the sets of three points
|
|
856
|
+
* tetrahedron.faces.push([0, 1, 2]);
|
|
857
|
+
* tetrahedron.faces.push([0, 1, 3]);
|
|
858
|
+
* tetrahedron.faces.push([0, 2, 3]);
|
|
859
|
+
* tetrahedron.faces.push([1, 2, 3]);
|
|
860
|
+
* tetrahedron.makeEdgesFromFaces();
|
|
861
|
+
* }
|
|
862
|
+
* function draw() {
|
|
863
|
+
* background(200);
|
|
864
|
+
* strokeWeight(2);
|
|
865
|
+
* orbitControl();
|
|
866
|
+
* rotateY(millis() * 0.001);
|
|
867
|
+
* model(tetrahedron);
|
|
868
|
+
* }
|
|
869
|
+
* </code>
|
|
870
|
+
* </div>
|
|
871
|
+
*/
|
|
872
|
+
function makeEdgesFromFaces(): void;
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Transforms the geometry's vertices to fit snugly within a 100×100×100 box
|
|
876
|
+
* centered at the origin.Calling `myGeometry.normalize()` translates the geometry's vertices so that
|
|
877
|
+
* they're centered at the origin `(0, 0, 0)`. Then it scales the vertices so
|
|
878
|
+
* that they fill a 100×100×100 box. As a result, small geometries will grow
|
|
879
|
+
* and large geometries will shrink.Note: `myGeometry.normalize()` only works when called in the
|
|
880
|
+
* setup() function.
|
|
881
|
+
*
|
|
882
|
+
* @example <div>
|
|
883
|
+
* <code>
|
|
884
|
+
* let myGeometry;
|
|
885
|
+
*
|
|
886
|
+
* function setup() {
|
|
887
|
+
* createCanvas(100, 100, WEBGL);
|
|
888
|
+
*
|
|
889
|
+
* // Create a very small torus.
|
|
890
|
+
* myGeometry = buildGeometry(function() {;
|
|
891
|
+
* torus(1, 0.25);
|
|
892
|
+
* });
|
|
893
|
+
*
|
|
894
|
+
* // Normalize the torus so its vertices fill
|
|
895
|
+
* // the range [-100, 100].
|
|
896
|
+
* myGeometry.normalize();
|
|
897
|
+
*
|
|
898
|
+
* describe('A white torus rotates slowly against a dark gray background.');
|
|
899
|
+
* }
|
|
900
|
+
*
|
|
901
|
+
* function draw() {
|
|
902
|
+
* background(50);
|
|
903
|
+
*
|
|
904
|
+
* // Turn on the lights.
|
|
905
|
+
* lights();
|
|
906
|
+
*
|
|
907
|
+
* // Rotate around the y-axis.
|
|
908
|
+
* rotateY(frameCount * 0.01);
|
|
909
|
+
*
|
|
910
|
+
* // Style the torus.
|
|
911
|
+
* noStroke();
|
|
912
|
+
*
|
|
913
|
+
* // Draw the torus.
|
|
914
|
+
* model(myGeometry);
|
|
915
|
+
* }
|
|
916
|
+
* </code>
|
|
917
|
+
* </div>
|
|
918
|
+
*/
|
|
919
|
+
function normalize(): void;
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* Sets the shader's vertex property or attribute variables.A vertex property, or vertex attribute, is a variable belonging to a vertex in a shader. p5.js provides some
|
|
923
|
+
* default properties, such as `aPosition`, `aNormal`, `aVertexColor`, etc. These are
|
|
924
|
+
* set using vertex(), normal()
|
|
925
|
+
* and fill() respectively. Custom properties can also
|
|
926
|
+
* be defined within beginShape() and
|
|
927
|
+
* endShape().The first parameter, `propertyName`, is a string with the property's name.
|
|
928
|
+
* This is the same variable name which should be declared in the shader, as in
|
|
929
|
+
* `in vec3 aProperty`, similar to .`setUniform()`.The second parameter, `data`, is the value assigned to the shader variable. This value
|
|
930
|
+
* will be pushed directly onto the Geometry object. There should be the same number
|
|
931
|
+
* of custom property values as vertices, this method should be invoked once for each
|
|
932
|
+
* vertex.The `data` can be a Number or an array of numbers. Tn the shader program the type
|
|
933
|
+
* can be declared according to the WebGL specification. Common types include `float`,
|
|
934
|
+
* `vec2`, `vec3`, `vec4` or matrices.See also the global vertexProperty() function.
|
|
935
|
+
*
|
|
936
|
+
* @example <div>
|
|
937
|
+
* <code>
|
|
938
|
+
* let geo;
|
|
939
|
+
*
|
|
940
|
+
* function cartesianToSpherical(x, y, z) {
|
|
941
|
+
* let r = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
|
|
942
|
+
* let theta = acos(z / r);
|
|
943
|
+
* let phi = atan2(y, x);
|
|
944
|
+
* return { theta, phi };
|
|
945
|
+
* }
|
|
946
|
+
*
|
|
947
|
+
* function setup() {
|
|
948
|
+
* createCanvas(100, 100, WEBGL);
|
|
949
|
+
*
|
|
950
|
+
* // Modify the material shader to display roughness.
|
|
951
|
+
* const myShader = baseMaterialShader().modify({
|
|
952
|
+
* vertexDeclarations:`in float aRoughness;
|
|
953
|
+
* out float vRoughness;`,
|
|
954
|
+
* fragmentDeclarations: 'in float vRoughness;',
|
|
955
|
+
* 'void afterVertex': `() {
|
|
956
|
+
* vRoughness = aRoughness;
|
|
957
|
+
* }`,
|
|
958
|
+
* 'vec4 combineColors': `(ColorComponents components) {
|
|
959
|
+
* vec4 color = vec4(0.);
|
|
960
|
+
* color.rgb += components.diffuse * components.baseColor * (1.0-vRoughness);
|
|
961
|
+
* color.rgb += components.ambient * components.ambientColor;
|
|
962
|
+
* color.rgb += components.specular * components.specularColor * (1.0-vRoughness);
|
|
963
|
+
* color.a = components.opacity;
|
|
964
|
+
* return color;
|
|
965
|
+
* }`
|
|
966
|
+
* });
|
|
967
|
+
*
|
|
968
|
+
* // Create the Geometry object.
|
|
969
|
+
* geo = buildGeometry(function() {
|
|
970
|
+
* fill('hotpink');
|
|
971
|
+
* sphere(45, 50, 50);
|
|
972
|
+
* });
|
|
973
|
+
*
|
|
974
|
+
* // Set the roughness value for every vertex.
|
|
975
|
+
* for (let v of geo.vertices){
|
|
976
|
+
*
|
|
977
|
+
* // convert coordinates to spherical coordinates
|
|
978
|
+
* let spherical = cartesianToSpherical(v.x, v.y, v.z);
|
|
979
|
+
*
|
|
980
|
+
* // Set the custom roughness vertex property.
|
|
981
|
+
* let roughness = noise(spherical.theta*5, spherical.phi*5);
|
|
982
|
+
* geo.vertexProperty('aRoughness', roughness);
|
|
983
|
+
* }
|
|
984
|
+
*
|
|
985
|
+
* // Use the custom shader.
|
|
986
|
+
* shader(myShader);
|
|
987
|
+
*
|
|
988
|
+
* describe('A rough pink sphere rotating on a blue background.');
|
|
989
|
+
* }
|
|
990
|
+
*
|
|
991
|
+
* function draw() {
|
|
992
|
+
* // Set some styles and lighting
|
|
993
|
+
* background('lightblue');
|
|
994
|
+
* noStroke();
|
|
995
|
+
*
|
|
996
|
+
* specularMaterial(255,125,100);
|
|
997
|
+
* shininess(2);
|
|
998
|
+
*
|
|
999
|
+
* directionalLight('white', -1, 1, -1);
|
|
1000
|
+
* ambientLight(320);
|
|
1001
|
+
*
|
|
1002
|
+
* rotateY(millis()*0.001);
|
|
1003
|
+
*
|
|
1004
|
+
* // Draw the geometry
|
|
1005
|
+
* model(geo);
|
|
1006
|
+
* }
|
|
1007
|
+
* </code>
|
|
1008
|
+
* </div>
|
|
1009
|
+
* @param the name of the vertex property.
|
|
1010
|
+
* @param the data tied to the vertex property.
|
|
1011
|
+
* @param optional size of each unit of data.
|
|
1012
|
+
*/
|
|
1013
|
+
function vertexProperty(propertyName: string, data: number | number[], size?: number): void;
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* The `saveObj()` function exports `p5.Geometry` objects as
|
|
1017
|
+
* 3D models in the Wavefront .obj file format.
|
|
1018
|
+
* This way, you can use the 3D shapes you create in p5.js in other software
|
|
1019
|
+
* for rendering, animation, 3D printing, or more.The exported .obj file will include the faces and vertices of the `p5.Geometry`,
|
|
1020
|
+
* as well as its texture coordinates and normals, if it has them.
|
|
1021
|
+
*
|
|
1022
|
+
* @param The name of the file to save the model as.
|
|
1023
|
+
* If not specified, the default file name will be 'model.obj'.
|
|
1024
|
+
* @example <div>
|
|
1025
|
+
* <code>
|
|
1026
|
+
* let myModel;
|
|
1027
|
+
* let saveBtn;
|
|
1028
|
+
* function setup() {
|
|
1029
|
+
* createCanvas(200, 200, WEBGL);
|
|
1030
|
+
* myModel = buildGeometry(function()) {
|
|
1031
|
+
* for (let i = 0; i < 5; i++) {
|
|
1032
|
+
* push();
|
|
1033
|
+
* translate(
|
|
1034
|
+
* random(-75, 75),
|
|
1035
|
+
* random(-75, 75),
|
|
1036
|
+
* random(-75, 75)
|
|
1037
|
+
* );
|
|
1038
|
+
* sphere(random(5, 50));
|
|
1039
|
+
* pop();
|
|
1040
|
+
* }
|
|
1041
|
+
* });
|
|
1042
|
+
*
|
|
1043
|
+
* saveBtn = createButton('Save .obj');
|
|
1044
|
+
* saveBtn.mousePressed(() => myModel.saveObj());
|
|
1045
|
+
*
|
|
1046
|
+
* describe('A few spheres rotating in space');
|
|
1047
|
+
* }
|
|
1048
|
+
*
|
|
1049
|
+
* function draw() {
|
|
1050
|
+
* background(0);
|
|
1051
|
+
* noStroke();
|
|
1052
|
+
* lights();
|
|
1053
|
+
* rotateX(millis() * 0.001);
|
|
1054
|
+
* rotateY(millis() * 0.002);
|
|
1055
|
+
* model(myModel);
|
|
1056
|
+
* }
|
|
1057
|
+
* </code>
|
|
1058
|
+
* </div>
|
|
1059
|
+
*/
|
|
1060
|
+
function saveObj(fileName: string): void;
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* The `saveStl()` function exports `p5.Geometry` objects as
|
|
1064
|
+
* 3D models in the STL stereolithography file format.
|
|
1065
|
+
* This way, you can use the 3D shapes you create in p5.js in other software
|
|
1066
|
+
* for rendering, animation, 3D printing, or more.The exported .stl file will include the faces, vertices, and normals of the `p5.Geometry`.By default, this method saves a text-based .stl file. Alternatively, you can save a more compact
|
|
1067
|
+
* but less human-readable binary .stl file by passing `{ binary: true }` as a second parameter.
|
|
1068
|
+
*
|
|
1069
|
+
* @param The name of the file to save the model as.
|
|
1070
|
+
* If not specified, the default file name will be 'model.stl'.
|
|
1071
|
+
* @param Optional settings. Options can include a boolean `binary` property, which
|
|
1072
|
+
* controls whether or not a binary .stl file is saved. It defaults to false.
|
|
1073
|
+
* @example <div>
|
|
1074
|
+
* <code>
|
|
1075
|
+
* let myModel;
|
|
1076
|
+
* let saveBtn1;
|
|
1077
|
+
* let saveBtn2;
|
|
1078
|
+
* function setup() {
|
|
1079
|
+
* createCanvas(200, 200, WEBGL);
|
|
1080
|
+
* myModel = buildGeometry(function() {
|
|
1081
|
+
* for (let i = 0; i < 5; i++) {
|
|
1082
|
+
* push();
|
|
1083
|
+
* translate(
|
|
1084
|
+
* random(-75, 75),
|
|
1085
|
+
* random(-75, 75),
|
|
1086
|
+
* random(-75, 75)
|
|
1087
|
+
* );
|
|
1088
|
+
* sphere(random(5, 50));
|
|
1089
|
+
* pop();
|
|
1090
|
+
* }
|
|
1091
|
+
* });
|
|
1092
|
+
*
|
|
1093
|
+
* saveBtn1 = createButton('Save .stl');
|
|
1094
|
+
* saveBtn1.mousePressed(function() {
|
|
1095
|
+
* myModel.saveStl();
|
|
1096
|
+
* });
|
|
1097
|
+
* saveBtn2 = createButton('Save binary .stl');
|
|
1098
|
+
* saveBtn2.mousePressed(function() {
|
|
1099
|
+
* myModel.saveStl('model.stl', { binary: true });
|
|
1100
|
+
* });
|
|
1101
|
+
*
|
|
1102
|
+
* describe('A few spheres rotating in space');
|
|
1103
|
+
* }
|
|
1104
|
+
*
|
|
1105
|
+
* function draw() {
|
|
1106
|
+
* background(0);
|
|
1107
|
+
* noStroke();
|
|
1108
|
+
* lights();
|
|
1109
|
+
* rotateX(millis() * 0.001);
|
|
1110
|
+
* rotateY(millis() * 0.002);
|
|
1111
|
+
* model(myModel);
|
|
1112
|
+
* }
|
|
1113
|
+
* </code>
|
|
1114
|
+
* </div>
|
|
1115
|
+
*/
|
|
1116
|
+
function saveStl(fileName: string, options?: object): void;
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Flips the geometry’s texture v-coordinates.In order for texture() to work, the geometry
|
|
1120
|
+
* needs a way to map the points on its surface to the pixels in a rectangular
|
|
1121
|
+
* image that's used as a texture. The geometry's vertex at coordinates
|
|
1122
|
+
* `(x, y, z)` maps to the texture image's pixel at coordinates `(u, v)`.The myGeometry.uvs array stores the
|
|
1123
|
+
* `(u, v)` coordinates for each vertex in the order it was added to the
|
|
1124
|
+
* geometry. Calling `myGeometry.flipV()` flips a geometry's v-coordinates
|
|
1125
|
+
* so that the texture appears mirrored vertically.For example, a plane's four vertices are added clockwise starting from the
|
|
1126
|
+
* top-left corner. Here's how calling `myGeometry.flipV()` would change a
|
|
1127
|
+
* plane's texture coordinates:`// Print the original texture coordinates.
|
|
1128
|
+
* // Output: [0, 0, 1, 0, 0, 1, 1, 1]
|
|
1129
|
+
* console.log(myGeometry.uvs);
|
|
1130
|
+
*
|
|
1131
|
+
* // Flip the v-coordinates.
|
|
1132
|
+
* myGeometry.flipV();
|
|
1133
|
+
*
|
|
1134
|
+
* // Print the flipped texture coordinates.
|
|
1135
|
+
* // Output: [0, 1, 1, 1, 0, 0, 1, 0]
|
|
1136
|
+
* console.log(myGeometry.uvs);
|
|
1137
|
+
*
|
|
1138
|
+
* // Notice the swaps:
|
|
1139
|
+
* // Left vertices: [0, 0] <--> [1, 0]
|
|
1140
|
+
* // Right vertices: [1, 0] <--> [1, 1]`
|
|
1141
|
+
*
|
|
1142
|
+
* @for p5.Geometry
|
|
1143
|
+
* @example <div>
|
|
1144
|
+
* <code>
|
|
1145
|
+
* let img;
|
|
1146
|
+
*
|
|
1147
|
+
* async function setup() {
|
|
1148
|
+
* img = await loadImage('assets/laDefense.jpg');
|
|
1149
|
+
* createCanvas(100, 100, WEBGL);
|
|
1150
|
+
*
|
|
1151
|
+
* background(200);
|
|
1152
|
+
*
|
|
1153
|
+
* // Create p5.Geometry objects.
|
|
1154
|
+
* let geom1 = buildGeometry(createShape);
|
|
1155
|
+
* let geom2 = buildGeometry(createShape);
|
|
1156
|
+
*
|
|
1157
|
+
* // Flip geom2's V texture coordinates.
|
|
1158
|
+
* geom2.flipV();
|
|
1159
|
+
*
|
|
1160
|
+
* // Left (original).
|
|
1161
|
+
* push();
|
|
1162
|
+
* translate(-25, 0, 0);
|
|
1163
|
+
* texture(img);
|
|
1164
|
+
* noStroke();
|
|
1165
|
+
* model(geom1);
|
|
1166
|
+
* pop();
|
|
1167
|
+
*
|
|
1168
|
+
* // Right (flipped).
|
|
1169
|
+
* push();
|
|
1170
|
+
* translate(25, 0, 0);
|
|
1171
|
+
* texture(img);
|
|
1172
|
+
* noStroke();
|
|
1173
|
+
* model(geom2);
|
|
1174
|
+
* pop();
|
|
1175
|
+
*
|
|
1176
|
+
* describe(
|
|
1177
|
+
* 'Two photos of a ceiling on a gray background. The photos are mirror images of each other.'
|
|
1178
|
+
* );
|
|
1179
|
+
* }
|
|
1180
|
+
*
|
|
1181
|
+
* function createShape() {
|
|
1182
|
+
* plane(40);
|
|
1183
|
+
* }
|
|
1184
|
+
* </code>
|
|
1185
|
+
* </div>
|
|
1186
|
+
*/
|
|
1187
|
+
function flipV(): void;
|
|
1188
|
+
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
export default function p5_Geometry(p5: any, fn: any): void;
|