Blender V4.5
blender::bke::curves::poly Namespace Reference

Functions

void calculate_tangents (Span< float3 > positions, bool is_cyclic, MutableSpan< float3 > tangents)
void calculate_normals_minimum (Span< float3 > tangents, bool cyclic, MutableSpan< float3 > normals)
void calculate_normals_z_up (Span< float3 > tangents, MutableSpan< float3 > normals)
static bool delta_dir (const float3 &pos, const float3 &next, float3 &r_delta_dir)
static float3 direction_bisect (const float3 &pos, const float3 &next, float3 &other_dir, bool &is_equal)
static float3 calculate_next_normal (const float3 &last_normal, const float3 &last_tangent, const float3 &current_tangent)

Function Documentation

◆ calculate_next_normal()

float3 blender::bke::curves::poly::calculate_next_normal ( const float3 & last_normal,
const float3 & last_tangent,
const float3 & current_tangent )
static

◆ calculate_normals_minimum()

void blender::bke::curves::poly::calculate_normals_minimum ( Span< float3 > tangents,
bool cyclic,
MutableSpan< float3 > normals )

◆ calculate_normals_z_up()

void blender::bke::curves::poly::calculate_normals_z_up ( Span< float3 > tangents,
MutableSpan< float3 > normals )

Calculate a vector perpendicular to every tangent on the X-Y plane (unless the tangent is vertical, in that case use the X direction).

Definition at line 106 of file curve_poly.cc.

References BLI_assert, calculate_normals_z_up(), i, blender::MutableSpan< T >::index_range(), blender::math::normalize(), blender::MutableSpan< T >::size(), and blender::Span< T >::size().

Referenced by calculate_normals_z_up(), and blender::bke::CurvesGeometry::evaluated_normals().

◆ calculate_tangents()

void blender::bke::curves::poly::calculate_tangents ( Span< float3 > positions,
bool is_cyclic,
MutableSpan< float3 > tangents )

Calculate the direction at every point, defined as the normalized average of the two neighboring segments (and if non-cyclic, the direction of the first and last segments). This is different than evaluating the derivative of the basis functions for curve types like NURBS, Bezier, or Catmull Rom, though the results may be similar.

Definition at line 54 of file curve_poly.cc.

References BLI_assert, calculate_tangents(), delta_dir(), direction_bisect(), blender::IndexRange::drop_back(), blender::IndexRange::drop_front(), blender::MutableSpan< T >::fill(), blender::MutableSpan< T >::first(), blender::Span< T >::first(), i, blender::Span< T >::index_range(), blender::IndexRange::IndexRange(), blender::Span< T >::is_empty(), blender::MutableSpan< T >::last(), blender::Span< T >::last(), blender::MutableSpan< T >::size(), blender::Span< T >::size(), and blender::MutableSpan< T >::slice().

Referenced by calculate_tangents(), and blender::bke::CurvesGeometry::evaluated_tangents().

◆ delta_dir()

bool blender::bke::curves::poly::delta_dir ( const float3 & pos,
const float3 & next,
float3 & r_delta_dir )
static

◆ direction_bisect()

float3 blender::bke::curves::poly::direction_bisect ( const float3 & pos,
const float3 & next,
float3 & other_dir,
bool & is_equal )
static

Computes an approximate tangent from the normalized sum from the direction vectors to neighboring points on the curve.

Definition at line 30 of file curve_poly.cc.

References blender::math::almost_equal_relative(), direction_bisect(), blender::math::normalize(), and UNLIKELY.

Referenced by calculate_tangents(), and direction_bisect().