This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
ofPolyline.inl
Go to the documentation of this file.
69 points.insert( points.end(), verts.begin(), verts.end() );
76 curveVertices.clear();
79}
100 ofLogError("ofPolyline") << "removeVertex(): ignoring out of range index " << index << ", number of vertices is" << points.size();
104 flagHasChanged();
124 flagHasChanged();
131 points.resize(size);
215void ofPolyline_<T>::bezierTo( const T & cp1, const T & cp2, const T & to, int curveResolution ){
262void ofPolyline_<T>::quadBezierTo(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, int curveResolution){
331void ofPolyline_<T>::arc(const T & center, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise, int circleResolution){
374 point = T(cos(angleBeginRad), sin(angleBeginRad), 0.f);
410 }
413 point = point * radii + center;
419 point = T(cos(angleEndRad), sin(angleEndRad), 0.f);
424 }
463 }
481 weights[i] = curWeight;
495 }
499 }
502 }
506 }
509 result[i] /= sum;
513}
543 ofLogWarning("ofPolyline_") << "getResampledByCount(): requested " << count <<" points, using minimum count of 2 ";
687 //This is for polygon/contour simplification - we use it to reduce the number of points needed in
898 int i1 = ofClamp(floor(length / totalLength * lastPointIndex), 0, lengths.size()-2); // start approximation here
1085void ofPolyline_<T>::calcData(int index, T &tangent, float &angle, T &rotation, T &normal) const {
1165 centroid2D.x += (points[i].x + points[i+1].x) * (points[i].x*points[i+1].y - points[i+1].x*points[i].y);
1166 centroid2D.y += (points[i].y + points[i+1].y) * (points[i].x*points[i+1].y - points[i+1].x*points[i].y);
1168 centroid2D.x += (points[points.size()-1].x + points[0].x) * (points[points.size()-1].x*points[0].y - points[0].x*points[points.size()-1].y);
1169 centroid2D.y += (points[points.size()-1].y + points[0].y) * (points[points.size()-1].x*points[0].y - points[0].x*points[points.size()-1].y);
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
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
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 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
T getTangentAtIndexInterpolated(float findex) const
Get tangent vector at interpolated index (interpolated between neighboring indices)
Definition ofPolyline.inl:1056
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
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
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 draw() const
Draw the line using the current renderer.
Definition ofPolyline.inl:870
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
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
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
float getMaxX() const
Get the largest x position of the ofRectangle as float.
Definition ofRectangle.cpp:626
float getMaxY() const
Get the largest y position of the ofRectangle as float.
Definition ofRectangle.cpp:636
void growToInclude(float px, float py)
Grow the ofRectangle to include the given (x, y) coordinates.
Definition ofRectangle.cpp:494
float getMinX() const
Get the smallest x position of the ofRectangle as float.
Definition ofRectangle.cpp:621
float getMinY() const
Get the smallest y position of the ofRectangle as float.
Definition ofRectangle.cpp:631
glm::vec3 getMax() const
Get the maximum x and y coordinates of the ofRectangle as glm::vec3.
Definition ofRectangle.cpp:616
glm::vec3 getMin() const
Get the minimum x and y coordinates of the ofRectangle as glm::vec3.
Definition ofRectangle.cpp:611
void set(float px, float py, float w, float h)
Set the position and size of the rectangle.
Definition ofRectangle.cpp:47
std::enable_if_t< std::is_arithmetic_v< T >, T > normal(T mean, T stddev)
Definition ofRandomDistributions.h:80
Definition ofEvents.cpp:625
shared_ptr< ofBaseRenderer > & ofGetCurrentRenderer()
Definition ofAppRunner.cpp:317
float ofWrap(float value, float from, float to)
Find a value within a given range, wrapping the value if it overflows.
Definition ofMath.cpp:151
float ofClamp(float value, float min, float max)
Clamp a value between min and max.
Definition ofMath.cpp:120
float ofLerp(float start, float stop, float amt)
Linearly interpolate a value within a range.
Definition ofMath.cpp:147
float ofMap(float value, float inputMin, float inputMax, float outputMin, float outputMax, bool clamp)
Given a value and an input range, map the value to an output range.
Definition ofMath.cpp:78
#define d
#define a
#define c
#define b
T getClosestPointUtil(const T &p1, const T &p2, const T &p3, float *normalizedPosition)
Definition ofPolyline.inl:552
Definition ofPolyline.inl:698