Py5Shape.get_height()#

Get the Py5Shape object’s height.

Examples#

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

Description#

Get the Py5Shape object’s height. When using the P2D or P3D renderers, the returned value should be the height of the drawn shape. When using the default renderer, this will be the height of the drawing area, which will not necessarily be the same as the height of the drawn shape. Consider that the shape’s vertices might have negative values or the shape may be offset from the shape’s origin. To get the shape’s actual height, calculate the range of the vertices obtained with Py5Shape.get_vertex_y().

Underlying Processing method: PShape.getHeight

Syntax#

get_height() -> float

Updated on November 12, 2021 11:30:58am UTC