10 #ifndef INCLUDED_IMATHLINE_H
11 #define INCLUDED_IMATHLINE_H
17 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
106 return pos + dir * parameter;
113 return (closestPointTo (point) - point).length();
120 return ((point - pos) ^ dir) * dir + pos;
127 T d = (dir % line.dir) ^ (line.pos - pos);
128 return (d >= 0) ? d : -d;
137 Vec3<T> posLpos = pos - line.pos;
139 T a = line.dir ^ dir;
140 T f = line.dir ^ posLpos;
145 T absDenom = ((denom >= 0) ? denom : -denom);
149 T absNum = ((num >= 0) ? num : -num);
155 return pos + dir * (num / denom);
161 operator<< (std::ostream& o, const Line3<T>& line)
163 return o <<
"(" << line.pos <<
", " << line.dir <<
")";
167 template <
class S,
class T>
171 return Line3<S> (line.pos * M, (line.pos + line.dir) * M);
174 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
176 #endif // INCLUDED_IMATHLINE_H
Mat3< typename promote< S, T >::type > operator*(S scalar, const Mat3< T > &m)
Multiply each element of the given matrix by scalar and return the result.
Vec3< T > pos
A point on the line.
GLboolean GLboolean GLboolean GLboolean a
IMATH_HOSTDEVICE constexpr Vec3< T > operator()(T parameter) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr Line3() IMATH_NOEXCEPT
Uninitialized by default.
Vec3< T > dir
The direction of the line.
Line3< double > Line3d
Line of type double.
IMATH_HOSTDEVICE void set(const Vec3< T > &point1, const Vec3< T > &point2) IMATH_NOEXCEPT
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
IMATH_HOSTDEVICE constexpr T distanceTo(const Vec3< T > &point) const IMATH_NOEXCEPT
Return the distance to the given point.
Line3< float > Line3f
Line of type float.
IMATH_HOSTDEVICE constexpr Vec3< T > closestPointTo(const Vec3< T > &point) const IMATH_NOEXCEPT
Return the point on the line closest to the given point.