ofDoc > graphics > ofPath

ofPathfile

ofPath::Commandstruct

Types

Type enum

Attributes

type variable
to variable
cp1 variable
cp2 variable
radiusX variable
radiusY variable
angleBegin variable
angleEnd variable

Functions

Command ()

ofPathclass

ofPath is a way to create a path or multiple paths consisting of points. It allows you to combine multiple paths consisting of points into a single vector data object that can be drawn to the screen, manipulated point by point, or manipulated with it's child subpaths. It is better at representing and manipulating complex shapes than the ofPolyline and more easily represents multiple child lines or shapes as either ofSubPath or ofPolyline instances. By default ofPath uses ofSubPath instances. Closing the path automatically creates a new path:

for( int i = 0; i < 5; i++) {
// create a new ofSubPath
path.arc( i * 50 + 20, i * 50 + 20, i * 40 + 10, i * 40 + 10, 0, 360);
path.close();
}

To use ofPolyline instances, simply set the mode to POLYLINES

path.setMode(POLYLINES);

Create and remove paths and sub paths

ofPath ()
clear ()
close ()

Sub paths

lineTo ()
moveTo ()
curveTo ()
arc ()
circle ()
ellipse ()

Winding Mode

Drawing Mode

setArcResolution () Use setCircleResolution instead.
getArcResolution () Use getCircleResolution instead.

Drawing

draw ()

Functions

rotate ()
scale ()

Path Mode

Mode enum
setMode ()
getMode ()

Path Commands

Types