A generic line representation, which supports both 2D and 3D lines.
More...
#include <easy3d/core/line.h>
|
typedef Vec< DIM, FT > | Point |
| The type of the point.
|
|
typedef Vec< DIM, FT > | Vector |
| The type of the vector.
|
|
typedef GenericLine< DIM, FT > | thisclass |
| The type of this class.
|
|
|
| GenericLine ()=default |
| Default constructor.
|
|
void | set (const Point &p, const Vector &dir) |
| Sets a line from a point p and its direction dir .
|
|
const Vector & | direction () const |
| Returns the direction of the line.
|
|
const Point & | point () const |
| Returns an arbitrary point on the line.
|
|
Point | projection (const Point &p) const |
| Returns the projection of a point p on this line.
|
|
FT | squared_distance (const Point &p) const |
| Returns the squared distance of a point p to this line.
|
|
bool | feet (const thisclass &other, Point &p1, Point &p2) const |
| Computes the perpendicular feet with another line.
|
|
template<int DIM, typename FT>
class easy3d::GenericLine< DIM, FT >
A generic line representation, which supports both 2D and 3D lines.
- Template Parameters
-
DIM | The dimension of the line (2 or 3). |
FT | The type of the floating-point number (float or double). |
◆ direction()
template<int DIM, typename FT>
const Vector & direction |
( |
| ) |
const |
|
inline |
Returns the direction of the line.
- Returns
- The direction vector of the line.
◆ feet()
template<int DIM, typename FT>
Computes the perpendicular feet with another line.
- Parameters
-
other | Another line. |
p1 | The perpendicular foot on the current line. |
p2 | The perpendicular foot on the other line. |
- Returns
- True if the perpendicular feet exist, false if the two lines are parallel.
- Note
- This function is for 3D only.
◆ from_point_and_direction()
template<int DIM, typename FT>
Constructs a line from a point p
and its direction dir
.
- Parameters
-
p | The point on the line. |
dir | The direction of the line. |
- Returns
- A GenericLine object.
◆ from_two_points()
template<int DIM, typename FT>
Constructs a line from two points p
and q
.
- Parameters
-
p | The first point on the line. |
q | The second point on the line. |
- Returns
- A GenericLine object.
◆ point()
template<int DIM, typename FT>
const Point & point |
( |
| ) |
const |
|
inline |
Returns an arbitrary point on the line.
- Returns
- The point on the line.
◆ projection()
template<int DIM, typename FT>
Returns the projection of a point p
on this line.
- Parameters
-
- Returns
- The projection of the point on the line.
◆ set()
template<int DIM, typename FT>
Sets a line from a point p
and its direction dir
.
- Parameters
-
p | The point on the line. |
dir | The direction of the line. |
◆ squared_distance()
template<int DIM, typename FT>
FT squared_distance |
( |
const Point & | p | ) |
const |
|
inline |
Returns the squared distance of a point p
to this line.
- Parameters
-
p | The point to measure the distance to. |
- Returns
- The squared distance of the point to the line.
The documentation for this class was generated from the following file:
- G:/3_code/Easy3D/easy3d/core/line.h