Line3¶
#include <Imath/ImathLine.h>
The Line3
class template represents a line in 3D space, with
predefined typedefs for lines of type float
and double
.
There are also various utility functions that operate on Line3
objects defined in ImathLineAlgo.h
and described in Line
Functions.
Example:
#include <Imath/ImathLine.h>
#include <cassert>
void
line3_example ()
{
Imath::V3f a (0.0f, 0.0f, 0.0f);
Imath::V3f b (1.0f, 1.0f, 1.0f);
Imath::Line3f line (a, b);
assert (line.pos == a);
assert (line.dir == (b - a).normalized ());
Imath::V3f c (0.5f, 0.5f, 0.5f);
float f = line.distanceTo (c);
assert (Imath::equalWithAbsError (f, 0.0f, 0.0001f));
Imath::V3f p = line (0.5f); // midpoint, i.e. 0.5 units from a along (b-a)
assert (p.equalWithAbsError (
Imath::V3f (0.288675f, 0.288675f, 0.288675f), 0.0001f));
}
-
template<class T>
class Line3¶ The
Line3
class represents a 3D line, defined by a point and a direction vector.Direct access to member fields
Constructors
-
inline constexpr Line3() noexcept¶
Uninitialized by default.
Manipulation
Utility Methods
-
inline constexpr Vec3<T> operator()(T parameter) const noexcept¶
Return the point on the line at the given parameter value, e.g.
L(t)
-
inline constexpr T distanceTo(const Vec3<T> &point) const noexcept¶
Return the distance to the given point.
-
inline constexpr T distanceTo(const Line3<T> &line) const noexcept¶
Return the distance to the given line.
-
inline constexpr Line3() noexcept¶