|
JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins
« « « Anklang Documentation |
Represents a line. More...
#include "juce_Line.h"
Public Member Functions | |
| Line ()=default | |
| Creates a line, using (0, 0) as its start and end points. | |
| Line (const Line &)=default | |
| Creates a copy of another line. | |
| Line (ValueType startX, ValueType startY, ValueType endX, ValueType endY) noexcept | |
| Creates a line based on the coordinates of its start and end points. | |
| Line (Point< ValueType > startPoint, Point< ValueType > endPoint) noexcept | |
| Creates a line from its start and end points. | |
| Line & | operator= (const Line &)=default |
| Copies a line from another one. | |
| ~Line ()=default | |
| Destructor. | |
| ValueType | getStartX () const noexcept |
| Returns the x coordinate of the line's start point. | |
| ValueType | getStartY () const noexcept |
| Returns the y coordinate of the line's start point. | |
| ValueType | getEndX () const noexcept |
| Returns the x coordinate of the line's end point. | |
| ValueType | getEndY () const noexcept |
| Returns the y coordinate of the line's end point. | |
| Point< ValueType > | getStart () const noexcept |
| Returns the line's start point. | |
| Point< ValueType > | getEnd () const noexcept |
| Returns the line's end point. | |
| void | setStart (ValueType newStartX, ValueType newStartY) noexcept |
| Changes this line's start point. | |
| void | setEnd (ValueType newEndX, ValueType newEndY) noexcept |
| Changes this line's end point. | |
| void | setStart (const Point< ValueType > newStart) noexcept |
| Changes this line's start point. | |
| void | setEnd (const Point< ValueType > newEnd) noexcept |
| Changes this line's end point. | |
| Line | reversed () const noexcept |
| Returns a line that is the same as this one, but with the start and end reversed,. | |
| void | applyTransform (const AffineTransform &transform) noexcept |
| Applies an affine transform to the line's start and end points. | |
| ValueType | getLength () const noexcept |
| Returns the length of the line. | |
| ValueType | getLengthSquared () const noexcept |
| Returns the length of the line. | |
| bool | isVertical () const noexcept |
| Returns true if the line's start and end x coordinates are the same. | |
| bool | isHorizontal () const noexcept |
| Returns true if the line's start and end y coordinates are the same. | |
| Point< ValueType >::FloatType | getAngle () const noexcept |
| Returns the line's angle. | |
| Line< float > | toFloat () const noexcept |
| Casts this line to float coordinates. | |
| Line< double > | toDouble () const noexcept |
| Casts this line to double coordinates. | |
| bool | operator== (Line other) const noexcept |
| Compares two lines. | |
| bool | operator!= (Line other) const noexcept |
| Compares two lines. | |
| Point< ValueType > | getIntersection (Line line) const noexcept |
| Finds the intersection between two lines. | |
| bool | intersects (Line line, Point< ValueType > &intersection) const noexcept |
| Finds the intersection between two lines. | |
| bool | intersects (Line other) const noexcept |
| Returns true if this line intersects another. | |
| Point< ValueType > | getPointAlongLine (ValueType distanceFromStart) const noexcept |
| Returns the location of the point which is a given distance along this line. | |
| Point< ValueType > | getPointAlongLine (ValueType distanceFromStart, ValueType perpendicularDistance) const noexcept |
| Returns a point which is a certain distance along and to the side of this line. | |
| Point< ValueType > | getPointAlongLineProportionally (typename Point< ValueType >::FloatType proportionOfLength) const noexcept |
| Returns the location of the point which is a given distance along this line proportional to the line's length. | |
| ValueType | getDistanceFromPoint (Point< ValueType > targetPoint, Point< ValueType > &pointOnLine) const noexcept |
| Returns the smallest distance between this line segment and a given point. | |
| ValueType | findNearestProportionalPositionTo (Point< ValueType > point) const noexcept |
| Finds the point on this line which is nearest to a given point, and returns its position as a proportional position along the line. | |
| Point< ValueType > | findNearestPointTo (Point< ValueType > point) const noexcept |
| Finds the point on this line which is nearest to a given point. | |
| bool | isPointAbove (Point< ValueType > point) const noexcept |
| Returns true if the given point lies above this line. | |
| Line | withLengthenedStart (ValueType distanceToLengthenBy) const noexcept |
| Returns a lengthened copy of this line. | |
| Line | withShortenedStart (ValueType distanceToShortenBy) const noexcept |
| Returns a shortened copy of this line. | |
| Line | withLengthenedEnd (ValueType distanceToLengthenBy) const noexcept |
| Returns a lengthened copy of this line. | |
| Line | withShortenedEnd (ValueType distanceToShortenBy) const noexcept |
| Returns a shortened copy of this line. | |
Static Public Member Functions | |
| static Line | fromStartAndAngle (Point< ValueType > startPoint, ValueType length, ValueType angle) noexcept |
| Creates a line from a start point, length and angle. | |
Represents a line.
This class contains a bunch of useful methods for various geometric tasks.
The ValueType template parameter should be a primitive type - float or double are what it's designed for. Integer types will work in a basic way, but some methods that perform mathematical operations may not compile, or they may not produce sensible results.
@tags{Graphics}
Definition at line 46 of file juce_Line.h.
|
noexcept |
Creates a line based on the coordinates of its start and end points.
Definition at line 57 of file juce_Line.h.
|
noexcept |
Creates a line from its start and end points.
Definition at line 63 of file juce_Line.h.
|
noexcept |
Applies an affine transform to the line's start and end points.
Definition at line 109 of file juce_Line.h.
|
noexcept |
Finds the point on this line which is nearest to a given point.
Definition at line 315 of file juce_Line.h.
|
noexcept |
Finds the point on this line which is nearest to a given point, and returns its position as a proportional position along the line.
Definition at line 301 of file juce_Line.h.
|
staticnoexcept |
Creates a line from a start point, length and angle.
This angle is the number of radians clockwise from the 12 o'clock direction, where the line's start point is considered to be at the centre.
Definition at line 140 of file juce_Line.h.
|
noexcept |
Returns the line's angle.
This value is the number of radians clockwise from the 12 o'clock direction, where the line's start point is considered to be at the centre.
Definition at line 133 of file juce_Line.h.
|
noexcept |
Returns the smallest distance between this line segment and a given point.
So if the point is close to the line, this will return the perpendicular distance from the line; if the point is a long way beyond one of the line's end-point's, it'll return the straight-line distance to the nearest end-point.
pointOnLine receives the position of the point that is found.
Definition at line 262 of file juce_Line.h.
|
noexcept |
Returns the line's end point.
Definition at line 91 of file juce_Line.h.
|
noexcept |
Returns the x coordinate of the line's end point.
Definition at line 82 of file juce_Line.h.
|
noexcept |
Returns the y coordinate of the line's end point.
Definition at line 85 of file juce_Line.h.
|
noexcept |
Finds the intersection between two lines.
| line | the line to intersect with |
Definition at line 165 of file juce_Line.h.
|
noexcept |
Returns the length of the line.
Definition at line 117 of file juce_Line.h.
|
noexcept |
Returns the length of the line.
Definition at line 120 of file juce_Line.h.
|
noexcept |
Returns the location of the point which is a given distance along this line.
| distanceFromStart | the distance to move along the line from its start point. This value can be negative or longer than the line itself |
Definition at line 204 of file juce_Line.h.
|
noexcept |
Returns a point which is a certain distance along and to the side of this line.
This effectively moves a given distance along the line, then another distance perpendicularly to this, and returns the resulting position.
| distanceFromStart | the distance to move along the line from its start point. This value can be negative or longer than the line itself |
| perpendicularDistance | how far to move sideways from the line. If you're looking along the line from its start towards its end, then a positive value here will move to the right, negative value move to the left. |
Definition at line 223 of file juce_Line.h.
|
noexcept |
Returns the location of the point which is a given distance along this line proportional to the line's length.
| proportionOfLength | the distance to move along the line from its start point, in multiples of the line's length. So a value of 0.0 will return the line's start point and a value of 1.0 will return its end point. (This value can be negative or greater than 1.0). |
Definition at line 246 of file juce_Line.h.
|
noexcept |
Returns the line's start point.
Definition at line 88 of file juce_Line.h.
|
noexcept |
Returns the x coordinate of the line's start point.
Definition at line 76 of file juce_Line.h.
|
noexcept |
Returns the y coordinate of the line's start point.
Definition at line 79 of file juce_Line.h.
|
noexcept |
Finds the intersection between two lines.
| line | the other line |
| intersection | the position of the point where the lines meet (or where they would meet if they were infinitely long) the intersection (if the lines intersect). If the lines are parallel, this will just be set to the position of one of the line's endpoints. |
Definition at line 184 of file juce_Line.h.
|
noexcept |
Returns true if this line intersects another.
Definition at line 190 of file juce_Line.h.
|
noexcept |
Returns true if the line's start and end y coordinates are the same.
Definition at line 126 of file juce_Line.h.
|
noexcept |
Returns true if the given point lies above this line.
The return value is true if the point's y coordinate is less than the y coordinate of this line at the given x (assuming the line extends infinitely in both directions).
Definition at line 326 of file juce_Line.h.
|
noexcept |
Returns true if the line's start and end x coordinates are the same.
Definition at line 123 of file juce_Line.h.
|
noexcept |
Compares two lines.
Definition at line 157 of file juce_Line.h.
|
noexcept |
Compares two lines.
Definition at line 154 of file juce_Line.h.
|
noexcept |
Returns a line that is the same as this one, but with the start and end reversed,.
Definition at line 106 of file juce_Line.h.
|
noexcept |
Changes this line's end point.
Definition at line 103 of file juce_Line.h.
|
noexcept |
Changes this line's end point.
Definition at line 97 of file juce_Line.h.
|
noexcept |
Changes this line's start point.
Definition at line 100 of file juce_Line.h.
|
noexcept |
Changes this line's start point.
Definition at line 94 of file juce_Line.h.
|
noexcept |
Casts this line to double coordinates.
Definition at line 150 of file juce_Line.h.
|
noexcept |
Casts this line to float coordinates.
Definition at line 147 of file juce_Line.h.
|
noexcept |
Returns a lengthened copy of this line.
This will extend the line by a certain amount by moving the end away from the start (leaving the start-point the same), and return the new line.
Definition at line 358 of file juce_Line.h.
|
noexcept |
Returns a lengthened copy of this line.
This will extend the line by a certain amount by moving the start away from the end (leaving the end-point the same), and return the new line.
Definition at line 337 of file juce_Line.h.
|
noexcept |
Returns a shortened copy of this line.
This will chop off part of the end of this line by a certain amount, (leaving the start-point the same), and return the new line.
Definition at line 368 of file juce_Line.h.
|
noexcept |
Returns a shortened copy of this line.
This will chop off part of the start of this line by a certain amount, (leaving the end-point the same), and return the new line.
Definition at line 348 of file juce_Line.h.