Py5Shape.is2d()#

Boolean value reflecting if the shape is or is not a 2D shape.

Examples#

example picture for is2d()
 1def setup():
 2    s = py5.create_shape()
 3    s.begin_shape()
 4    s.vertex(30, 20)
 5    s.vertex(85, 20)
 6    s.vertex(85, 75)
 7    s.vertex(30, 75)
 8    s.end_shape(py5.CLOSE)
 9
10    py5.println(s.is2d(), s.is3d())
11    py5.shape(s)
example picture for is2d()
 1def setup():
 2    py5.size(100, 100, py5.P3D)
 3    s = py5.create_shape()
 4    s.begin_shape()
 5    s.vertex(30, 20)
 6    s.vertex(85, 20)
 7    s.vertex(85, 75)
 8    s.vertex(30, 75)
 9    s.end_shape(py5.CLOSE)
10
11    py5.println(s.is2d(), s.is3d())
12    py5.shape(s)

Description#

Boolean value reflecting if the shape is or is not a 2D shape.

If the shape is created in a Sketch using the P3D renderer, this will be False, even if it only uses 2D coordinates.

Underlying Processing method: PShape.is2D

Syntax#

is2d() -> bool

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