This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
Go to the source code of this file.
Classes | |
class | ofPolyline_< T > |
Typedefs | |
using | ofPolyline = ofPolyline_< ofDefaultVertexType > |
Functions | |
template<class T > | |
bool | ofInsidePoly (float x, float y, const std::vector< T > &polygon) |
Determine if an (x,y) coordinate is within the polygon defined by a vector of glm::vec3s. | |
template<class T > | |
bool | ofInsidePoly (const T &p, const std::vector< T > &poly) |
Determine if an glm::vec3 is within the polygon defined by a vector of glm::vec3s. | |
Detailed Description
ofPolyLine allows you to combine multiple points into a single vector data object that can be drawn to the screen, manipulated point by point, and combined with other ofPolyline instances. It is less complex than the ofPath and generally represents a single line or vector shape rather than multiple lines or shapes.
You can add points to an ofPolyline by adding vertices:
Or you can draw lines or curves:
ofPolyline also includes methods to get the closest point, determine whether a point is inside shape, and resample shapes. Along with the ofPath class, it's the best way to draw and manipulate 2D and 3D vector graphics that you'll need to update and manipulate frequently.
If you use the lineTo() or curveTo() or bezierTo() functions, you move the drawing point, so that drawing a line to 100,100 means a line from 0,0 to 100, 100. The next line would be a line from 100,100 to wherever you go next. Storing this position means that you can easily create continuous drawings without difficulty.
Typedef Documentation
◆ ofPolyline
using ofPolyline = ofPolyline_<ofDefaultVertexType> |
Function Documentation
◆ ofInsidePoly() [1/2]
bool ofInsidePoly | ( | const T & | p, |
const std::vector< T > & | poly | ||
) |
Determine if an glm::vec3 is within the polygon defined by a vector of glm::vec3s.
- Parameters
-
p A point to check. poly A vector of glm::vec3s defining a polygon.
- Returns
- True if the glm::vec3 is enclosed, false otherwise.
◆ ofInsidePoly() [2/2]
bool ofInsidePoly | ( | float | x, |
float | y, | ||
const std::vector< T > & | polygon | ||
) |
Determine if an (x,y) coordinate is within the polygon defined by a vector of glm::vec3s.
- Parameters
-
x The x dimension of the coordinate. y The y dimension of the coordinate. polygon a vector of glm::vec3s defining a polygon.
- Returns
- True if the point defined by the coordinates is enclosed, false otherwise.