This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
ofPolyline.h
Go to the documentation of this file.
190 void arc(const T & center, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise, int circleResolution = 20);
246 void arcNegative(const T & center, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20) {
249 void arcNegative(float x, float y, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20){
252 void arcNegative(float x, float y, float z, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20){
311 void quadBezierTo(float cx1, float cy1, float cz1, float cx2, float cy2, float cz2, float x, float y, float z, int curveResolution = 20);
323 void quadBezierTo(float cx1, float cy1, float cx2, float cy2, float x, float y, int curveResolution = 20){
478 OF_DEPRECATED_MSG("Use Deg/Rad versions.", float getAngleAtIndexInterpolated(float findex) const);
540 mutable std::vector<float> lengths; // cumulative lengths, stored per point (lengths[n] is the distance to the n'th point, zero based)
543 mutable std::vector<T> rotations; // rotation axes between adjacent segments, stored per point (cross product)
544 mutable std::vector<float> angles; // angle (rad) between adjacent segments, stored per point (asin(cross product))
Definition ofPolyline.h:56
float getPerimeter() const
Gets the size of the perimeter of the polyline, good for determining length of the line,...
Definition ofPolyline.inl:430
float getRadiansAtIndex(int index) const
Get angle (degrees) of the path at index.
Definition ofPolyline.inl:1012
size_t size() const
The number of points in the ofPolyline.
Definition ofPolyline.inl:111
OF_DEPRECATED_MSG("Use Deg/Rad versions.", void rotate(float degrees, const glm::vec2 &axis))
ofPolyline_ getSmoothed(int smoothingSize, float smoothingShape=0) const
Gets a smoothed version of the ofPolyline.
Definition ofPolyline.inl:470
float getIndexAtLength(float f) const
Get (interpolated) index at given length along the path.
Definition ofPolyline.inl:889
void quadBezierTo(float cx1, float cy1, float cz1, float cx2, float cy2, float cz2, float x, float y, float z, int curveResolution=20)
Adds a quadratic bezier line in 3D space from the current drawing point with the beginning indicated ...
Definition ofPolyline.inl:262
void bezierTo(float cx1, float cy1, float cx2, float cy2, float x, float y, int curveResolution=20)
Adds a cubic bezier line from the current drawing point with the 2 control points indicated by the co...
Definition ofPolyline.h:294
ofRectangle getBoundingBox() const
Get the bounding box of the polyline , taking into account all the points to determine the extents of...
Definition ofPolyline.inl:455
void arcNegative(float x, float y, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution=20)
Definition ofPolyline.h:249
void setClosed(bool tf)
Closes the ofPolyline, meaning that all the vertices will be linked and can be "walked".
Definition ofPolyline.inl:137
float getDegreesAtIndexInterpolated(float findex) const
Get angle (degrees) at interpolated index (interpolated between neighboring indices)
Definition ofPolyline.inl:1001
void quadBezierTo(const T &p1, const T &p2, const T &p3, int curveResolution=20)
Adds a quadratic bezier line in 2D space from the current drawing point with the beginning indicated ...
Definition ofPolyline.h:316
T getTangentAtIndexInterpolated(float findex) const
Get tangent vector at interpolated index (interpolated between neighboring indices)
Definition ofPolyline.inl:1056
OF_DEPRECATED_MSG("Use Deg/Rad versions.", float getAngleAtIndex(int index) const)
Get angle (degrees) of the path at index.
OF_DEPRECATED_MSG("Use Deg/Rad versions.", float getAngleAtIndexInterpolated(float findex) const)
Get angle (degrees) at interpolated index (interpolated between neighboring indices)
void addVertex(const T &p)
Adds a point using an T at the end of the ofPolyline.
Definition ofPolyline.inl:51
T getPointAtLength(float f) const
Get point long the path at a given length (e.g. f=150 => 150 units along the path)
Definition ofPolyline.inl:951
void clear()
Removes all the points from the ofPolyline.
Definition ofPolyline.inl:42
void arc(const T ¢er, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise, int circleResolution=20)
Adds an arc around the T center with the width of radiusX and the height of radiusY to the polyline.
Definition ofPolyline.inl:331
float getRadiansAtIndexInterpolated(float findex) const
Get angle (degrees) at interpolated index (interpolated between neighboring indices)
Definition ofPolyline.inl:1020
static bool inside(float x, float y, const ofPolyline_ &polyline)
Tests whether the x,y coordinates are within a closed ofPolyline.
Definition ofPolyline.inl:639
void bezierTo(const T &cp1, const T &cp2, const T &to, int curveResolution=20)
Adds a cubic bezier line from the current drawing point with the 2 control points indicated by T cp1 ...
Definition ofPolyline.inl:215
T getRotationAtIndex(int index) const
Get rotation vector at index (magnitude is sine of angle)
Definition ofPolyline.inl:1030
T getCentroid2D() const
Get the center of the area bounded by the line.
Definition ofPolyline.inl:448
bool hasChanged()
Returns whether the vertices within the line have changed.
Definition ofPolyline.inl:156
void arcNegative(float x, float y, float z, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution=20)
Definition ofPolyline.h:252
void quadBezierTo(float cx1, float cy1, float cx2, float cy2, float x, float y, int curveResolution=20)
Adds a quadratic bezier line in 2D space from the current drawing point with the beginning indicated ...
Definition ofPolyline.h:323
T getNormalAtIndexInterpolated(float findex) const
Get normal vector at interpolated index (interpolated between neighboring indices)
Definition ofPolyline.inl:1074
T getClosestPoint(const T &target, unsigned int *nearestIndex=nullptr) const
Gets the point on the line closest to the target. You can also optionally pass a pointer to/address o...
Definition ofPolyline.inl:583
T getRotationAtIndexInterpolated(float findex) const
Get rotation vector at interpolated index (interpolated between neighboring indices) (magnitude is si...
Definition ofPolyline.inl:1038
float getArea() const
Gets the precise area bounded by the line.
Definition ofPolyline.inl:441
OF_DEPRECATED_MSG("Use Deg/Rad versions.", void rotate(float degrees, const glm::vec3 &axis))
float getDegreesAtIndex(int index) const
Get angle (degrees) of the path at index.
Definition ofPolyline.inl:993
static ofPolyline_ fromRectangle(const ofRectangle &rect)
Definition ofPolyline.inl:30
void scale(float x, float y)
Change the size of the ofPolyline These changes are non-reversible, so for instance scaling by 0,...
Definition ofPolyline.inl:860
ofPolyline_ getResampledByCount(int count) const
Resamples the line based on the count passed in. The lower the count passed in, the more points will ...
Definition ofPolyline.inl:540
T getNormalAtIndex(int index) const
Get normal vector at index.
Definition ofPolyline.inl:1066
void arcNegative(const T ¢er, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution=20)
Definition ofPolyline.h:246
void draw() const
Draw the line using the current renderer.
Definition ofPolyline.inl:870
void arc(float x, float y, float z, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution=20)
Adds an arc around the coordinates (x,y,z) with the width of radiusX and the height of radiusY.
Definition ofPolyline.h:243
void rotateDeg(float degrees, const glm::vec3 &axis)
Definition ofPolyline.inl:821
float getLengthAtIndexInterpolated(float findex) const
Get length along path at interpolated index (e.g. f=5.75 => 75% along the path between 5th and 6th po...
Definition ofPolyline.inl:939
T getTangentAtIndex(int index) const
Get tangent vector at index.
Definition ofPolyline.inl:1048
T getPointAtIndexInterpolated(float findex) const
Get point along the path at interpolated index (e.g. f=5.75 => 75% along the path between 5th and 6th...
Definition ofPolyline.inl:967
void lineTo(const T &to)
Add a straight line from the last point added, or from 0,0 if no point is set, to the point indicated...
Definition ofPolyline.h:168
void close()
Closes the ofPolyline, meaning that all the vertices will be linked and can be "walked".
Definition ofPolyline.inl:150
ofPolyline_ getResampledBySpacing(float spacing) const
Resamples the line based on the spacing passed in. The larger the spacing, the more points will be el...
Definition ofPolyline.inl:517
void rotateRad(float radians, const glm::vec3 &axis)
Definition ofPolyline.inl:827
int getWrappedIndex(int index) const
Get wrapped index depending on whether poly is closed or not.
Definition ofPolyline.inl:1120
void simplify(float tolerance=0.3f)
Simplifies the polyline, removing un-necessary vertices.
Definition ofPolyline.inl:756
void arc(float x, float y, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution=20)
Adds an arc around the coordinates (x,y) with the width of radiusX and the height of radiusY.
Definition ofPolyline.h:231
void curveTo(float x, float y, float z=0, int curveResolution=20)
Adds a curve to the x,y,z points passed in with the optional resolution.
Definition ofPolyline.h:275
T getPointAtPercent(float f) const
Get point along the path at a given percentage (e.g. f=0.25 => 25% along the path)
Definition ofPolyline.inl:959
void bezierTo(float cx1, float cy1, float cz1, float cx2, float cy2, float cz2, float x, float y, float z, int curveResolution=20)
Adds a cubic bezier line in 3D space from the current drawing point with the 2 control points indicat...
Definition ofPolyline.h:301
void arc(const T ¢er, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution=20)
Adds an arc around the T center with the width of radiusX and the height of radiusY.
Definition ofPolyline.h:219
std::vector< T > & getVertices()
Gets a vector of vertices that the line contains.
Definition ofPolyline.inl:174
void removeVertex(int index)
Remove a vertex at a given index.
Definition ofPolyline.inl:98
void curveTo(const T &to, int curveResolution=20)
Adds a curve to an T object passed in.
Definition ofPolyline.inl:279
float getLengthAtIndex(int index) const
Get length along path at index.
Definition ofPolyline.inl:931
void resize(size_t size)
Resize the number of points in the ofPolyline to the value passed in.
Definition ofPolyline.inl:130
void addVertices(const std::vector< T > &verts)
Add multiple points at the end of the ofPolyline using a vector of T objects.
Definition ofPolyline.inl:67
float getIndexAtPercent(float f) const
Get (interpolated) index at given percentage along the path.
Definition ofPolyline.inl:925
void lineTo(float x, float y, float z=0)
Add a straight line from the last point added, or from 0,0 if no point is set, to the point indicated...
Definition ofPolyline.h:172
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.
Definition ofPolyline.h:574