Py5Shape.get_vertex_y()

Get the value of the y coordinate for the vertex index.

Examples

example picture for get_vertex_y()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def setup():
    s1 = py5.create_shape()
    s1.begin_shape()
    s1.vertex(20, 80)
    s1.vertex(80, 80)
    s1.vertex(50, 20)
    s1.end_shape(py5.CLOSE)
    py5.shape(s1)
    y_values = [s1.get_vertex_y(i) for i in range(s1.get_vertex_count())]
    py5.println(s1.get_height(), min(y_values), max(y_values))  # 80, 20, 80
example picture for get_vertex_y()
1
2
3
4
5
6
7
def setup():
    py5.size(100, 100, py5.P3D)
    py5.sphere_detail(8)
    s1 = py5.create_shape(py5.SPHERE, 40)
    y_values = [s1.get_vertex_y(i) for i in range(s1.get_vertex_count())]
    py5.shape(s1, 50, 50)
    py5.println(s1.get_height(), min(y_values), max(y_values))  # 80, -40, 40

Description

Get the value of the y coordinate for the vertex index.

Underlying Java method: PShape.getVertexY

Syntax

get_vertex_y(index: int, /) -> float

Parameters

  • index: int - vertex index

Updated on September 11, 2021 16:51:34pm UTC