Reference×
Reference
- [] (array access)
- = (assign)
- catch
- class
- , (comma)
- // (comment)
- {} (curly braces)
- /** */ (doc comment)
- . (dot)
- draw()
- exit()
- extends
- false
- final
- implements
- import
- loop()
- /* */ (multiline comment)
- new
- noLoop()
- null
- () (parentheses)
- popStyle()
- pop()
- private
- public
- pushStyle()
- push()
- redraw()
- return
- ; (semicolon)
- setLocation()
- setResizable()
- setTitle()
- setup()
- static
- super
- this
- thread()
- true
- try
- void
Name
getVertexCount()
Class
PShape
Description
The getVertexCount() method returns the number of vertices that make up a PShape. In the above example, the value 4 is returned by the getVertexCount() method because 4 vertices are defined in setup().
Examples
PShape s; void setup() { size(100, 100); s = createShape(); s.beginShape(); s.vertex(0, 0); s.vertex(60, 0); s.vertex(60, 60); s.vertex(0, 60); s.endShape(CLOSE); } void draw() { translate(20, 20); for (int i = 0; i < s.getVertexCount(); i++) { PVector v = s.getVertex(i); v.x += random(-1, 1); v.y += random(-1, 1); s.setVertex(i, v); } shape(s); }
Syntax
sh.getVertexCount()
Parameters
sh(PShape)any variable of type PShape
Return
int

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.