2D line specified by a pair of start/end points.
More...
#include <line.hpp>
template<
typename T>
class tc::sdk::line< T >
2D line specified by a pair of start/end points.
- Template Parameters
-
T | Underlying points coordinate type. |
- Examples
- example_geometry_line.cpp.
Definition at line 31 of file line.hpp.
◆ line()
|
inlineexplicitconstexprnoexcept |
Constructor. Creates tc::sdk::line instance with given start and end points.
- Parameters
-
start | the start point of the line. |
end | the end point of the line. |
Definition at line 54 of file line.hpp.
◆ operator==()
Equality operator.
- Parameters
-
other | the line to compare against. |
- Returns
- true if the two lines have the same start and end points.
Definition at line 75 of file line.hpp.
◆ operator!=()
Inequality operator.
- Parameters
-
other | the line to compare against. |
- Returns
- true if the two lines have different start or end points.
Definition at line 86 of file line.hpp.
◆ is_null()
Check if the line is a point.
- Returns
- true if the start and end points are the same.
Definition at line 95 of file line.hpp.
◆ is_vertical()
Check if the line is vertical.
- Returns
- true if the start and end points have the same x coordinate.
Definition at line 104 of file line.hpp.
◆ is_horizontal()
Check if the line is horizontal.
- Returns
- true if the start and end points have the same y coordinate.
Definition at line 113 of file line.hpp.
◆ start()
Start point getter.
- Returns
- Start point of the line.
Definition at line 122 of file line.hpp.
◆ end()
End point getter.
- Returns
- End point of the line.
Definition at line 131 of file line.hpp.
◆ set_start()
Start point setter. Set the start point of the line.
Definition at line 139 of file line.hpp.
◆ set_end()
End point setter. Set the end point of the line.
Definition at line 147 of file line.hpp.
◆ intersects()
Check if the given line segments intersects the current instance.
- Parameters
-
other | the line to check the intersection against. |
- Returns
- true if the two lines intersects.
Definition at line 157 of file line.hpp.
◆ get_intersection()
Computes the intersection between the given line and the current one.
- Parameters
-
other | the compute to check the intersection against. |
- Returns
- std::nullopt if the two lines do not intersect, otherwise a std::optional<tc::sdk::point<double>> with the intersection point.
Definition at line 167 of file line.hpp.
◆ to_string()
Get the line string representation.
- Returns
- String representation of the current line.
Definition at line 207 of file line.hpp.
◆ operator<<
Output stream operator.
- Parameters
-
stream | the output stream to write into. |
l | the line object to stream. |
- Returns
- reference to the output stream operator, with the line string representation written into it.
Definition at line 218 of file line.hpp.
The documentation for this class was generated from the following file:
- sdk/include/teiacare/sdk/geometry/line.hpp