Blender V5.0
blender::ed::sculpt_paint::brushes::clay_strips Namespace Reference

Functions

float4x4 calc_local_matrix (const Brush &brush, const StrokeCache &cache, const float3 &plane_normal, const float3 &plane_center, const bool flip)
CursorSampleResult calc_node_mask (const Depsgraph &depsgraph, Object &ob, const Brush &brush, IndexMaskMemory &memory)
static bool node_in_box (const float4x4 &mat, const Bounds< float3 > &bounds)

Function Documentation

◆ calc_local_matrix()

◆ calc_node_mask()

◆ node_in_box()

bool blender::ed::sculpt_paint::brushes::clay_strips::node_in_box ( const float4x4 & mat,
const Bounds< float3 > & bounds )
static

Checks whether the node's bounding box overlaps with the region affected by the brush. Clay Strips affects only vertices below the brush plane. The brush-local coordinate system is oriented so that vertices below the plane have positive local z-coordinates. Therefore, we only need to check if the node intersects the [-1,1] x [-1,1] x [0,1] volume in local space.

Intersection is tested using the Separating Axis Theorem. Two boxes (not necessarily axis-aligned) intersect if and only if there does not exist an axis that separates them. In particular, it is necessary and sufficient to:

Definition at line 381 of file clay_strips.cc.

References blender::math::abs(), blender::math::cross(), blender::math::dot(), blender::math::transform_point(), blender::MatBase< T, NumCol, NumRow, Alignment >::x_axis(), blender::MatBase< T, NumCol, NumRow, Alignment >::y_axis(), and blender::MatBase< T, NumCol, NumRow, Alignment >::z_axis().

Referenced by calc_node_mask().