Name

point()

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 above example.

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

Point appears round with the default strokeCap(ROUND) and square with strokeCap(PROJECT). Points are invisible with strokeCap(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 set() or drawing the point using either circle() or square().

Examples

  • size(400, 400);
    noSmooth();
    point(120, 80);
    point(340, 80);
    point(340, 300);
    point(120, 300);
    Image output for example 1
  • size(400, 400, P3D);
    noSmooth();
    point(120, 80, -200);
    point(340, 80, -200);
    point(340, 300, -200);
    point(120, 300, -200);
    Image output for example 2

Syntax

  • point(x, y)
  • point(x, y, z)

Parameters

  • x(float)x-coordinate of the point
  • y(float)y-coordinate of the point
  • z(float)z-coordinate of the point

Return

  • void

Related