point()

Draws a point, a coordinate in space at the dimension of one pixel.

Examples

example picture for point()
1
2
3
4
5
6
def setup():
    py5.no_smooth()
    py5.point(30, 20)
    py5.point(85, 20)
    py5.point(85, 75)
    py5.point(30, 75)
example picture for point()
1
2
3
4
5
6
7
def setup():
    py5.size(100, 100, py5.P3D)
    py5.no_smooth()
    py5.point(30, 20, -50)
    py5.point(85, 20, -50)
    py5.point(85, 75, -50)
    py5.point(30, 75, -50)

Description

Draws a point, a coordinate in space at the dimension of one pixel. The first parameter is the horizontal value for the point, the second value is the vertical value for the point, and the optional third value is the depth value. Drawing this shape in 3D with the z parameter requires the P3D parameter in combination with size() as shown in the second example.

Use stroke() to set the color of a point().

Point appears round with the default stroke_cap(ROUND) and square with stroke_cap(PROJECT). Points are invisible with stroke_cap(SQUARE) (no cap).

Using point() with strokeWeight(1) or smaller may draw nothing to the screen, depending on the graphics settings of the computer. Workarounds include setting the pixel using the pixels[] or np_pixels[] arrays or drawing the point using either circle() or square().

Underlying Java method: point

Syntax

point(x: float, y: float, /) -> None
point(x: float, y: float, z: float, /) -> None

Parameters

  • x: float - x-coordinate of the point

  • y: float - y-coordinate of the point

  • z: float - z-coordinate of the point

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