#include <primitives.h>
template<typename T>
Line3d_ class
Represents a line/segment in 3d Euclidean space.
Contents
Public types
Constructors, destructors, conversion operators
Public functions
-
auto Reversed() const -> Line3d_
- Returns a line with flipped direction vector.
-
auto From() const -> const vec_
type& - For a segment, this returns the start point. For a line, it's simply one of the given points to construct the line in the first place.
-
void SetFrom(const vec_
type& from) - Sets the first reference point (starting point of a line segment; or any point on a line).
-
auto To() const -> const vec_
type& - For a segment, this returns the end point. For a line, it's simply one of the given points to construct the line in the first place.
-
void SetTo(const vec_
type& to) - Sets the second reference point (end point of a line segment; or any point on a line).
- auto Length() const -> double
- Returns the length from the start to the end point. As such, it's only meaningful for a line segment.
-
auto Direction() const -> vec_
type - Returns the non-normalized direction vector from the start point to the end point.
-
auto UnitDirection() const -> vec_
type - Returns the unit direction vector from the start point to the end point.
-
auto MidPoint() const -> vec_
type - Returns the point halfway between from and to.
- auto IsValid() const -> bool
- Returns true if the line object is valid, i.e. start and end points are not the same.
-
auto AngleRad(const vec_
type& v) const -> double - Returns the angle between the line and the given directional vector. The angle will be between 0 and Pi.
-
auto AngleDeg(const vec_
type& v) const -> double - Returns the angle between the line and the given directional vector. The angle will be between 0 and 180 degrees.
-
auto AngleRad(const Plane_
<T>& plane) const -> double - Returns the angle between the line and the plane. The angle will be between -Pi/2 and Pi/2.
-
auto AngleDeg(const Plane_
<T>& plane) const -> double - Returns the angle between the line and the plane. The angle will be between -90 and +90 degrees.
-
auto PointAtOffset(double offset_factor) const -> vec_
type - Returns the point which is offset * Direction() away from the line's starting point, i.e. offset == 0 is the starting point, offset == 1 is the end point.
-
auto ClosestPointOnLine(const vec_
type& point) const -> vec_ type - Returns the closest point on the line, i.e. the projection of the given point onto this line.
-
auto ClosestPointOnSegment(const vec_
type& point) const -> vec_ type - Returns the point on this line segment(!) which is closest to the given point.
-
auto DistancePointToLine(const vec_
type& point) const -> double - Returns the minimum distance between the point and this line.
-
auto DistancePointToSegment(const vec_
type& point) const -> double - Returns the minimum distance between the point and this segment.
Friends
-
auto operator<<(std::ostream& stream,
const Line3d_
& line) -> std::ostream& - Overloaded output stream operator.