47 const float dist0 =
math::dot(tangent, pos0 - origin);
48 const float lambda = dist0 /
len;
49 if (lambda < 0.0f || lambda > 1.0f) {
80 const float3 segment = pos1 - pos0;
81 const float3 dist0 = pos0 - ray_pos;
82 const float a =
math::dot(segment, dist0);
84 const float c =
math::dot(segment, ray_dir);
87 if (len_segment_sq <= 1
e-9) [[unlikely]] {
99 const float ray_lambda = c * segment_lambda +
b;
constexpr T clamp(T, U, U) RET
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
T length_squared(const VecBase< T, Size > &a)
T clamp(const T &a, const T &min, const T &max)
T safe_divide(const T &a, const T &b)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
T interpolate(const T &a, const T &b, const FactorT &t)
bool is_unit(const VecBase< T, Size > &a, const T epsilon=T(10) *std::numeric_limits< T >::epsilon())
std::optional< PlaneIntersection > intersect_plane(const float3 &pos0, const float3 &pos1, const float3 &origin, const float3 &edge, const float3 &normal)
SegmentClosestToRay closest_on_segment_to_ray(const float3 &pos0, const float3 &pos1, const float3 &ray_pos, const float3 &ray_dir, const bool clamp)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
VecBase< float, 3 > float3
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e